jquery Ajax does not perform the callback function success Reason:
$.ajax ({
Type: "Post",
ContentType: "Application/json",
url:basepath+ "pages/tongji/disposeagree.action?cepingitem=" +cepingitem+ "&userrelation=" +userrelation,
Data: {Fenshu:8},
DataType: "JSON",
Success:function (Result) {
Alert ("Operation succeeded");
},
Error:function (response) {
Alert ("Error");
}
});
As above, because the property datatype: "JSON", if the background is not returned by the correct JSON string, then never execute the callback function success, and only execute the error function. Either return the correct JSON string or change the DataType property to text
The correct return JSON string is as follows:
Pw.write ("{\" name\ ": \" Zs\ "}");
Pw.write ("{\" name\ ":" +true+ "}");
Examples of errors:
Pw.write ("{'name':'zs'}");
Why jquery Ajax does not perform callback function success