我的联系表单适用于Chrome& Safari但它在Firefox或IE中不起作用。它一直作为GET提交。有谁能找到问题?
<form action="#" id="contactForm">
<input type="submit" id="contactClick" class="button white" style="margin-top:-2px;" name="submit" value="Send it!">
</form>
var $contactClick = $("#contactClick"),$contactForm = $("#contactForm"),$emailText = $("#emailText"),$emailSubmit = $("#emailSubmit"),$form = $("#contactForm"), $emailSubmit = $("#emailSubmit");
$("#contactForm").submit(function(){
event.preventDefault();
$contactClick.attr('disabled', 'disabled');
$contactClick.attr('value', 'Sending . . .');
var url = "/backend/page-content/emailPOST.php"; // the script where you handle the form input.
$.ajax({
type: "POST",
url: url,
data: $contactForm.serialize(), // serializes the form's elemWorkents.
success: function(data)
{
$emailText.text(data);
$emailSubmit.fadeIn(400);
$contactClick.removeAttr('disabled');
$contactClick.attr('value', 'SEND IT!');
var noticeLength = $emailText.text();
if(noticeLength.length > 27){ $contactForm[0].reset(); }
}
});
return false;
});
答案 0 :(得分:1)
回调函数中没有事件参数。
$("#contactForm").submit(function(event)