Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
116
rated 0 times [  117] [ 1]  / answers: 1 / hits: 29329  / 12 Years ago, sun, november 25, 2012, 12:00:00

i have form like



<form id=abc>
<div>
<select >
<option id= 1> ha1 </option>
<option id= 1> ha2 </option>
<option id= 1> ha3 </option>
<option id= 1> ha4 </option>
</select>
<input type=submit>
</div>
</form>


for form submit i have used like



 $(document).ready(function() {

$('#abc').submit(function(){

$.post('filter.php', $(this).serialize(), function(data){

$('#abc').reset(); //(this).reset();

});

return false;


});

});


Here reset is not working. Any problem with reset i am not getting.
After form submit, i want to refresh form with db values (to display values selected just now).



how can i refresh page after submit or either div refresh.


More From » jquery

 Answers
12
$(document).ready(function() {
$('#abc').submit(function(){
$.post('filter.php', $(this).serialize(), function(data){
window.location.href=window.location.href;
});
return false;
});

});


reloads the page by setting the href to the actual one :)



or you can also use this:



parent.document.getElementById(abc).reload();


by the way: i dont see your serverside code, you have to render the selected values, of course, i am assuming that you are returning them, my answer doesnot cover the serverside scene. my code is only for the case that you are returning the selected values from server after saving them into db.


[#81805] Friday, November 23, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
arthur

Total Points: 729
Total Questions: 107
Total Answers: 109

Location: China
Member since Mon, Aug 22, 2022
2 Years ago
;