簡體   English   中英

提交后重定向到同一頁面

[英]redirect to same page after submit

我要在表單中選擇文件更改時提交表單,並且能夠重定向到同一頁面。

即:我有這個網址: http:// localhost:3000 / worker_steps / basic_info 下拉列表更改后,我希望提交表單,然后再次重定向到http:// localhost:3000 / worker_steps / basic_info

我在html中有以下代碼:

<form class="simple_form form-horizontal" novalidate="novalidate" id="edit_user_385" enctype="multipart/form-data" action="/worker_steps/basic_info" accept-charset="UTF-8" method="post">
<input class="file optional" name="user[picture]" id="user_picture" type="file">  //this is th e dropdown select input

在我的jquery中,我有這個atm:

$("#user_picture").change(function(){
//window.location = "/worker_steps/basic_info";
$(this).closest("form").submit();    
});

我只是用這個:

window.location.replace(window.location.href);

您可以在其中使用標題

worker_steps/basic_info 

文件,因此將以下行放在文件末尾,

header('location:the_current_page.html');
exit();

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM