2017-06-02 48 views
0

我有一個AJAX功能這樣AJAX Sucess功能亙古不工作的Safari瀏覽器

$.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應用程序,它發送響應correclty。它在Chrome中完美運行,Im能夠在成功響應後轉至thankyou.html頁面。但是我的頁面並未導航到Safari瀏覽器中的thankyou.html。我正在使用safari 10.0.1。在我的Iphone或Ipad safari瀏覽器中也是如此。請幫助。感謝您提前回答

+1

這是一個錯字if(response =「Success」){??您需要有== –

+0

嘗試將location.href更改爲:window.location.href。 如果這不起作用,請嘗試使用window.location。 其中之一應該在Safari中工作。 – Korgrue

+0

@karthikGanesan。抱歉現在修復了錯字 – karthik006

回答

1

我不得不在表單sumbit結束時使用返回false來停止頁面刷新。

相關問題