Failed to load resource: Request timed out on Safari Failed to load resource: Request timed out on Safari ajax ajax

Failed to load resource: Request timed out on Safari


Set the async: true on your ajax settings. It will make the browser hold the connection and just close after receive the response back.


I got the same issue. Fixed by adding CORS header and response status code as 200

 res.header('Access-Control-Allow-Origin', '*'); res.status(200);

How & Why

After digging into the error by reading jQuery's source code, I realized the real problem is the XMLHttpRequest in jQuery+Safari is calling onError with a http status code0. So I added CORS headers and give it a 200 status code to solve the problem.


I think your issue will be fixed if you remove dataType : "json" from the code if the return from your ajax page is not a proper JSON string. I've noticed that the $.ajax() doesn't go to the success function if the dataType : "json" is provided and the return data is not of the type JSON.

PS
There are certain things like the AJAX settings keywords type, dataType, url etc are not supposed to be in double quotes. Even though code will work even with the current way, but proper way is what I mentioned.

$.ajax({      type      : methode,      dataType  : "json",      url       : url,      async     : async,      data      : donneesEnvoyees,      timeout   : 60000,      success   : function(data){                alert('success');      }});

I presume you have added a success function with this ajax call which you can use to use different actions based on the result.