1. Use the post submission method
2. Construct the form format
3. Call the ajax callback function in conjunction with the submit of the form form.
Use jQuery to submit the form code asynchronously:
< html xmlns="http://www.w3.org/1999/xhtml">
Untitled page
<script> <br>jQuery(function($) { <br>// Use jQuery Asynchronous form submission<br>$('#f1').submit(function() { <br>$.ajax({ <br>url: 'ta.aspx', <br>data: $('#f1' ).serialize(), <br>type: "post", <br>cache : false, <br>success: function(data) <br>{alert(data);} <br>}); <br> return false; <br>}); <br>}); <br></script>
How to submit a form asynchronously across domains?
1. Use the cross-domain access feature of script and combine it with the data formatting of the form, so it can only be submitted using the get method. For security reasons, the browser is Post cross-domain submission is not supported.
2. Using JSONP to submit forms across domains is a better solution.
3. You can also use a dynamic program as an agent. Use a proxy to forward cross-domain requests.
Use jQuery to asynchronously submit form code across domains:
Untitled page
head>
<script> <br>jQuery(function($) <br>{ <br>// Use jQuery to asynchronously submit the form across domains <br>$('#f1').submit(function() <br>{ <br>$.getJSON("ta.aspx?" $('#f1') .serialize() "&jsoncallback=?", <br>function(data) <br>{ <br>alert(data); <br>}); <br>return false; <br>}); <br> }); <br></script>