AJax Sucess功能在Safari浏览器上不起作用

时间:2017-06-02 18:42:23

标签: jquery node.js ajax express safari

我有像这样的ajax函数

    $.ajax({
  url: "thankyou",
  type: "POST", 
  data: arr,
  tryCount : 0,
  retryLimit : 3,
  success: function(response) {
    if(response == "Success"){
    location.href = "/thankyou.html";
   }else{console.log(response);}
  },
  error: function(xhr,textStatus) {
    if (textStatus == 'timeout') {
            this.tryCount++;
            if (this.tryCount <= this.retryLimit) {
                //try again
                $.ajax(this);
                return;
            }            
            return;
        }

  }
});

还有我的Nodejs express应用程序发送响应correclty。它在chrome中完美运行,并且能够在成功响应之后转到thankyou.html页面。但是我的页面在Safari浏览器中没有导航到thankyou.html。我正在使用safari 10.0.1。同样在我的Iphone或Ipad safari浏览器中也不起作用。请帮助。感谢您提前给出的答案

1 个答案:

答案 0 :(得分:1)

我不得不在表单sumbit的末尾使用return false来停止页面刷新。