0

我的联系表单在 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;
});
4

1 回答 1

1

回调函数中没有事件参数。

$("#contactForm").submit(function(event)
于 2013-09-09T12:46:30.470 回答