karthik006
karthik006

Reputation: 941

AJax Sucess function doesnot work on safari browser

I have a ajax function like this

    $.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;
        }

  }
});

There is also my Nodejs express app which sends the response correclty. It works perfectly in chrome and Im able to go to the thankyou.html page after successfull response. But my page doesn't navigate to thankyou.html in safari browser . I'm using safari 10.0.1 . The same doesn't work in my Iphone or Ipad safari browser as well. Kindly help . Thank you for the answer in advance

Upvotes: 0

Views: 108

Answers (1)

karthik006
karthik006

Reputation: 941

I had to use a return false at the end of form sumbit to stop the page refresh.

Upvotes: 1

Related Questions