This article is shared by the editor of Script House to share with you a summary of the answers to the error return error and error return in ajax in JQuery. Friends in need can refer to the following
Enter BaiduSearchThis question, I found someone said this
The async of Ajax in Jquery defaults to true (asynchronous request). If you want to execute another Ajax after it is executed, For an Ajax, you need to set async=false
I then processed it in ajax
async: false, and found that submitting normal data returned 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); }, });
The answer to jQuery ajax always returning error is as follows:
Today I used ajax to do asynchronous deletion and encountered a problem. ajax can request I found that some methods in action start with get. If you carefully print the return of ajax, you will definitely find that when ajax returns, it will obtain all methods starting with get in the action, including of course the methods in the action. After getting it, it is different from other get methods. you know! At this time, ajax will report a 500 error. Ajax will enter the error method when the status reaches 300.The modification method is: very simple, modify the method starting with get in the action to something else, for example;
public String getNetBut(){ bdiList=googleFlexDAO.getBuildingIpsById(araid.trim()); return SUCCESS; }
public String findNetBut(){ bdiList=googleFlexDAO.getBuildingIpsById(araid.trim()); return SUCCESS; }
The above is the detailed content of The answer to error returning error and always returning error in JQuery ajax. For more information, please follow other related articles on the PHP Chinese website!