Error returned by error in jquery ajax solution

Source: Internet
Author: User

Enter Baidu to search for the problem and find someone saying this

The default value of async in Ajax in Jquery is true (asynchronous request). If you want to execute another Ajax after Ajax is executed, you need to set async to false.

At that time, I processed it in ajax.

Async: false. The result shows that normal data submission is normal and no error is returned.

The code is as follows: Copy code

$. 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 );
},
});

Last, I would like to add:

The following two errors may occur when an error is sent, or other program problems may occur.
1. data: "{}". If the data is empty, you must pass "{}". Otherwise, the returned data is in xml format. The system 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.