如何删除event.preventDefault()?

时间:2014-01-31 16:18:43

标签: javascript-events

$("#submit").on("click", function() {
event.preventDefault();
var $data = $("#form");
    $.post($("#form").attr("action"), $data.serializeArray(), function(data) {
    var response = $.parseJSON(data);
        if(response.error == 'yes') // my code is ok here
                $("#error").stop().empty().show().html('<div id="resp_message">'+response.message+'</div>').fadeOut(5000);
        else // but here wont work
                $("#form").submit();
    });
});

我想要做的就是显示消息或提交查询是否正常 请帮帮我

1 个答案:

答案 0 :(得分:0)

你需要使用jQuery.off删除你的.on绑定,然后允许你绑定另一个没有preventDefault的点击处理程序

http://api.jquery.com/off/

相关问题