开发者

how to reload a div tag after submit? [closed]

开发者_如何学C It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years ago.

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');
     }  
   });  
  1. submit form data (formatted using serialize) using ajax to prevent page refresh
  2. reload your div content in the success event handler
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜