jquery ajax表单提交两次

我有一个表单,我通过jquery捕获并通过ajax发送。我的问题是,每次刷新页面时,表单都会提交多次。

我试图解除提交按钮的绑定,但是在第一次提交后,窗体就会正常发布。任何帮助将不胜感激

$('#exportForm').submit(function() {

  $.ajax({
    type: "POST",url: $(this).attr('action'),data: $(this).serialize(),success: function(response) {
      $('#exportForm').unbind('submit');
      console.log(response);
    }
  });

  return false;
});

解决方法

很可能您正在使用按钮或提交触发ajax事件。尝试这个:
$('#exportForm').submit(function(e){
        e.preventDefault();
        $.ajax({
            type: "POST",url: $(this).attr( 'action' ),success: function( response ) {
                console.log( response );
            }
        });

        return false;
    });

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: <span id=&quot...
jQuery 添加水印 <script src="../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...