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.