好日子夥計,我試圖提交一個窗體與文件使用jQuery表單插件,我正在驗證表單使用HTML5屬性,這就是爲什麼我已經添加'event.preventDefault();'ajaxForm不工作,如果有event.preventDefault函數
問題是,它不工作,它不顯示任何錯誤消息。
下面的代碼
function showResponse(responseText){
alert(responseText);
}
function beforeSub(){
alert("called");
}
$('#prodFormBtn').click(function(){
$("#addProductForm").ajaxForm({
beforeSubmit: beforeSub,
success: showResponse
}).submit(function(e){
e.preventDefault();
});