Reputation: 157
I want to submit a form when a file select is changed in my form and be able to redirect to same page.
ie: I have this url: http://localhost:3000/worker_steps/basic_info. after dropdown changed, I want the form be submitted and redirect again to http://localhost:3000/worker_steps/basic_info.
I have this code in 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
and in my jquery, I have this atm:
$("#user_picture").change(function(){
//window.location = "/worker_steps/basic_info";
$(this).closest("form").submit();
});
Upvotes: 1
Views: 1211
Reputation: 1563
You can use header in
worker_steps/basic_info
file, So put the below line at the end of the file,
header('location:the_current_page.html');
exit();
Upvotes: 0
Reputation: 34406
I would just use this:
window.location.replace(window.location.href);
Upvotes: 2