jquery Ajax Error return errors

Source: Internet
Author: User

Enter Baidu Search This problem, found that someone said a sentence

Ajax in jquery async default is True (asynchronous request), and if you want to perform another Ajax after an Ajax execution, you need to async=false it.

I handled it in Ajax.

Async:false, it turns out that submitting normal data returns is normal without errors.

The code is as follows

$.ajax ({
Type: "POST",
Async:false,
Url:urllink,
Data:data,
DataType: "HTML",
Success:function (msg) {
Alert (data)
},
Error:function (XMLHttpRequest, Textstatus, Errorthrown) {
alert (xmlhttprequest.status);
alert (xmlhttprequest.readystate);
alert (textstatus);
},
});

Finally, add one point:

Send error may have the following two, or other procedural problems, we need to be careful.

1, data: "{}", data is empty also must pass "{}"; otherwise, the return is in XML format. and prompts ParserError.

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.