Easyui the error handling returned by the service side when the form submits the interaction with SPRINGMVC

Source: Internet
Author: User

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

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.