在某些浏览器上停止Ajax调用

Joe*_*ell 0 javascript ajax jquery

根据控制台,这个Ajax 在商业环境中使用Firefox在某些 PC 上发布的调用不会发生(240个相同的安装).如果我删除了location.reload();那么Ajax帖子就好了.但是,浏览器没有刷新使用Ajax失败的观点.

我做错了什么吗?

 select: function(start, end, allDay, jsEvent, view) {                  
                    if (userID) {                   
                        var start = moment(start).format('YYYY-MM-DD')
                        var end = start;                
                        $.ajax({
                            type: "POST",
                            cache: false,
                            url: 'http://intakecalendar/adddate.php',
                            data: 'userID='+ userID + '&start=' + end   //+ '&end=' + end <-- Providing the REAL end date makes it show on the wrong day
                        });                     
                    } //End if
                    location.reload();
            } // end select
Run Code Online (Sandbox Code Playgroud)

epa*_*llo 6

这是一场竞争.您正在进行http调用并重新加载页面.只有一个会胜出现代浏览器,页面导航会中止打开http请求.

将重新加载移动到成功/完成处理程序.

select: function(start, end, allDay, jsEvent, view) {
  if (userID) {
    var start = moment(start).format('YYYY-MM-DD')
    var end = start;
    $.ajax({
      type: "POST",
      cache: false,
      url: 'http://intakecalendar/adddate.php',
      data: 'userID=' + userID + '&start=' + end, //+ '&end=' + end <-- Providing the REAL end date makes it show on the wrong day
      complete: function() {
        window.location.reload();
      }
    });
  } else {
    window.location.reload();
  }

}
Run Code Online (Sandbox Code Playgroud)