使用Ajax我使用的查詢驗證引擎:檢查用戶名在jQuery驗證引擎
http://www.position-relative.net/creation/formValidator/demos/demoValidators.html
我想用AJAX來驗證用戶名字段。如果用戶名已經存在於db ..它應該驗證。
這裏是我的代碼&東西,所以到目前爲止,我曾嘗試:
JS:
"ajaxUserNameCheck": {
"url": "phpajax/ajaxValidateFieldUser.php",
// you may want to pass extra data on the ajax call
"extraData": "name=eric",
// if you provide an "alertTextOk", it will show as a green prompt when the field validates
"alertTextOk": "* This username is available",
"alertText": "* This user is already taken",
"alertTextLoad": "* Validating, please wait"
},
HTML:
<input class="validate[custom[ajaxUserNameCheck]" type="text" name="userName" id="userName" ></div>
它返回警告錯誤:
jqv:custom type not allowed ajaxUserNameCheck