how to reload a div tag after submit? [closed]
how to reload a div tag after submit?
The following uses jQuery - well worth learning to simplify dealing with all things JavaScript.
$('#myform').submit(function(e) {
e.preventDefault();
$.ajax({
type: "POST",
url: "bin/process.php",
data: $(this).serialize(),
success: function() {
$('#mydiv').load('some/url/for/data');
}
});
- submit form data (formatted using serialize) using ajax to prevent page refresh
- reload your div content in the success event handler
精彩评论