0
我有下面的代碼提交表單,並與服務器的響應代替本身:jQuery的AJAX提交住進去()在Firefox中不工作只
$("form.replaceWithResponse").live("submit", function() {
event.preventDefault(); // not preventing default form submission in Firefox
var $this = $(this);
$.ajax({
data: $this.serialize(),
dataType: "html",
type: $this.attr("method"),
url: $this.attr("action"),
success: function(html) {
$this.replaceWith(html);
}
});
});
它可以在瀏覽器,但它不工作在Firefox中,除非我在開始時使用return false
而不是event.preventDefault()
。爲什麼?
謝謝!
我想我可能有問題的錯字,但讓我試,以確保。 –