2015-04-22 166 views
1

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

ie:我有這個網址: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();  
}); 
+0

您是否收到任何錯誤或什麼? – MTahir

回答

2

我只想用這樣的:

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

你可以使用標頭

worker_steps/basic_info 

文件, 所以把下面的一行在文件末尾,

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