The error callback function is not available in the submit interface of the Asyui form, and a solution on the web is to concatenate. Success (function () {}). Error (function () {}) and then unified processing through JQXHR But I have found that this scenario calls the. Error (), regardless of whether the server returns a correct or an exception, and it is a bit confusing to write code. After two days of groping, basically found the answer.
in the front Easyui the form submission can handle a successful callback by checking the data = = ' of Success ', while $.ajax commit specifies the error callback function.
The approximate code is as follows:
$.ajax ({
url:url,// Corresponding controller returns httpstatus.nocontent, error throws exception
type: ' Post ',
Data:data,
Success:function (res) {},//successfully processed
error:function (err) {}//error handling
});
$ (' #fm '). Form ({
url:url,//corresponding controller returns httpstatus.success, error throws exception
SUCCESS: Function (res) {
if (res = = ') {
//successfully processed
&nbs P }else{//error handling
}
},
' JSON '
});
Easyui form submits error handling returned by the server when interacting with SPRINGMVC