使用RSV jQuery驗證from here。成功jQuery驗證問題後的Ajax調用
真的停留在一個地方。我爲這個插件編寫了自定義錯誤處理程序(閱讀文檔,它是允許的),現在它顯示錯誤,並且一個接一個地關注確切的字段,然後在驗證結束時,如果沒有錯誤,我的自定義處理程序return (errorInfo.length == 0) ? true : false;
返回true。問題是,在這個rsv之後直接發送表單數據到PHP。但是我想在成功驗證後觸發Ajax函數。我爲「完成」事件寫了另一個函數wellDone()
,看起來插件根本不會觸發oncomplete函數。請幫我解決這個問題。
$(document).ready(function() {
$("#signup_form").RSV({
onCompleteHandler: wellDone,
customErrorHandler: errorHandler,
rules: signup_rules
});
});
function errorHandler(f, errorInfo)
{
for (var i=0; i<errorInfo.length; i++)
{
// errorInfo[i][0] contains the form field node that just failed the validation, e.g.
errorInfo[i][0].focus();
// errorInfo[i][1] contains the error string to display for this failed field, e.g.
$.notifyBar({
cls: "error",
html: errorInfo[i][1]
});
}
return (errorInfo.length == 0) ? true : false;
}
function wellDone(){
signUp();
}
var signup_rules = [
<some validation rules>...
]
也嘗試過。沒有成功。我們可以繼續對Skype進行討論嗎?我真的需要幫助隊友 – heron