This article will introduce you to the analysis and solutions for blocking jquery ajax form submit by the browser. I hope this tutorial will be helpful to you.
Normally, jquery's submit form submission will not be intercepted, but jquery ajax asynchronous submission will be rejected. Since it is a problem caused by asynchronous submission, it can be solved, because the jquery ajax method provides Parameter options:
Async:
(Default: true) by default, all requests are asynchronous requests. To send a synchronization request, set this option to false. Note: The synchronous request locks the browser. Other operations can be performed only after the request is completed.
The Code is as follows: |
Copy code |
$. Ajax ({ Url: "/member/pay/do_alipay ", Type: "GET ", DataType: "JSON ", Cache: false, Async: false, Data: data, Success: function (data ){ If (data. success ){ Form. submit (); } } });
|