JQuery Ajax request not working on iPhone device browser

前端 未结 5 1757
傲寒
傲寒 2021-02-10 02:07

We are in the process of developing an iPhone web app using extensive jquery AJAX calls to extract data from an XML web service. When developing and testing on my Mac on Safari

5条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-10 03:03

    Ok, I think we have solved this, although it still leaves me perplexed.

    If we do a 'dummy' XMLHttpRequest straight after the onReady() section in our code, then it seems to 'unblock' any following requests.

    http = new XMLHttpRequest();
    
    http.open("GET", "/getdata/dummy.xml);
    http.onreadystatechange=function() {
        if(http.readyState == 4) {
            // alert(http.responseText);
        }
    }
    http.send(null);
    

    If I comment out this code block, then following perfectly valid XML requests fail. Once again, this is only on the device, as Safari and the emulator will work without this code block in place.

    PS: dummy.xml simply returns "nothing"

提交回复
热议问题