0
我在我的網站上有一個簡單的聯繫表單,我希望使用AJAX/PHP發送數據。未處理的類型錯誤與AJAX處理表格
當我點擊提交按鈕,我得到的錯誤:
Uncaught TypeError: Cannot read property 'mode' of undefined
at Function.$.ajax (jquery.validate.js:1561)
at submitForm (form-scripts.js:21)
線21下方開始:
代碼:
$.ajax({
type: "POST",
url: "php/form-process.php",
data: "name=" + name + "&email=" + email + "&message=" + message,
success : function(text){
if (text == "success"){
formSuccess();
} else {
formError();
submitMSG(false,text);
}
}
});
我使用jQuery 3.1.1 (https://code.jquery.com/jquery-3.1.1.slim.min.js) - 也許這跟它有關係?
任何幫助將不勝感激。
問題似乎是在jquery驗證插件不在發佈的代碼中。 – Jai
@JAI道歉 - 這裏是供參考https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.16.0/jquery.validate.js – michaelmcgurk