Error (status 0) jQuery ajax with Safari and ios 7

I'm having a hard time working with Ajax call from Ipad (IOS 7.1) The code below works fine with IE, FF and Chromebut, not Safari (IOS 7.1) installed on the Ipad.

$.support.cors = true;
$.ajax(
{
    type:'GET',
    dataType: 'json',
    contentType: "application/json; charset=utf-8",
    headers: { "cache-control": "no-cache" },
    timeout: 5000,
    url:'mydomaine',
    crossDomain:true,
    cache:false,
    async:true,  
    success: function(data) {alert("OK");},
    error:function(xhr, status, errorThrown) {alert("OK");}
});

      

When calling this code from iPad (IOS 7.1) I got the following error:

xhr.status: 0
xhr.statusText: error
xhr.readyState: 0
xhr.responseText: 
xhr.responseXML: undefined
textStatus: error
errorThrown: 
xhr.redirect: undefined

      

I have used the following JS libraries

<script src="https://code.jquery.com/jquery-1.9.1.js"></script>

      

Note: t Note that the problem occurs with GET and POST, but not PUT.

In addition, the server handles the HTTP request well. For me, the problem is with the Safari browser handling the response.

Could you help me?

+3


source to share





All Articles