How to intercept jquery ajax form submission by the browser

Source: Internet
Author: User

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 ();
}
}
});

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.