How to use jquery.validationengine Ajax validation __ajax

Source: Internet
Author: User

One: Add ajax validation to an element in a form

<form id= "EditForm" action= "#" method= "POST" >
    <input id= "user" name= "user" type= "text" value= "class=" Validate[required,ajax[ajaxnamecall]] "/>
    <input type=" Submit "value=" submitted "/>
</form>

Two: Define AJAX validation related parameters

$.validationenginelanguage.allrules.ajaxnamecall = {
                "url": "/admin/user/validate",
                //"message when validation fails
                " Alerttext ": * This name has been used by others",
                ///Verify the success of the message
                "Alerttextok": "The name can be used",
                "alerttextload": "* is verifying, please wait ... "
            };

Third: Start the verification mechanism

$ready (function () {
        $ ("#editform"). Validationengine ();
    

Four: server-side processing

Two parameters to the server: Fieldid,fieldvalue, which implements the judgment logic based on these two parameters, and then returns an array of three elements: the element ID, whether the check passes (true or false), and the hint information. Note that strings need to be enclosed by double quotes.

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.