我在使用AJAX和JQuery提交表單時出錯,下面是我用來提交表單的代碼。使用Jquery提交AJAX表單時出錯
function formControl() {
$('form#form_contact').submit(function(){
if (verifyErrors()) {
action = $(this).attr('action');
mesagetosend = $(this).serialize();
$.ajax({
type: "POST",
url: 'mailscript/smtpmail.php',
data: mesagetosend,
dataType : "html",
timeout:10000,
error: function(msg) {
alert("Error:="+msg);
onerrormsg(msg);
},
success: function(msg){
alert("Success:="+msg);
onsuccessmsg(msg);
}
});
}
return false;
});
}
在警告我越來越"Error:=[object XMLHttpRequest]"
做任何人有任何想法,爲什麼它會返回錯誤???
使用'的console.log(味精);',而不是'警報( 「錯誤:=」 +味精) ;'與谷歌的Chrome瀏覽器,以獲得更好的調試消息 – dotoree 2012-03-27 11:02:38
thankx dotoree,會嘗試,現在 – mack 2012-03-27 11:03:29