In JQuery ajax, errors are returned and errors are always returned.

Source: Internet
Author: User

In JQuery ajax, errors are returned and errors are always returned.

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:

$.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.

JQuery ajax always returns the following error:

Today, I encountered a problem when I used ajax for asynchronous deletion. Ajax can request action and execute the method successfully. But the error method is always returned. After a long struggle. I also read a lot of information. It is basically a variety of attempts. I want to change to Ext ..

Some of the methods in action start with get. If you carefully print the ajax return, you will surely find That ajax returns all methods starting with get in action, including methods in action. The obtained method is different from other get methods. You know! At this time, ajax reports a 500 error. When the status of ajax reaches 300, the error method is entered.

The modification method is as follows: it is very easy to change the method starting with get in action to another example;

public String getNetBut(){     bdiList=googleFlexDAO.getBuildingIpsById(araid.trim());     return SUCCESS;   } 

To:

public String findNetBut(){     bdiList=googleFlexDAO.getBuildingIpsById(araid.trim());     return SUCCESS;   } 

This is OK! This error is generally hard to find, but you can still find it carefully!

All right, I hope you will like all the details about the error returned by JQuery ajax and the answers to the error always returned.

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.