Reputation: 621
We run a web service, and have built for it a website as a web app and an iPhone app using PhoneGap. We use ajax in both our web pages and PhoneGap pages to communicate with our server. All seems fine until one of our testing devices (iPhone 3Gs, iOS 4.3.2) constantly get empty response body from the XMLHttpRequest.
We use jQuery.ajax in the web app, and implemented a similar function in the PhoneGap app using XMLHttpRequest as well. We first found the PhoneGap app fails to sign in to our server on the 'wretched' iPhone 3Gs, then tried the web app on its Mobile Safari and found that fails the same. However, other websites(Google,GMail,Twitter,etc.) work with its Mobile Safari without any problem, and NONE of our other devices (even all iPhone 4.x Simulators) has this problem.
We debugged our code and found that the responseText we get from the XMLHttpRequest is malformed. When we parse it as JSON into an object, the result is an empty string (""). However, the status code is correct.
Is there anyone who has heard of such problem? We don't have another iPhone 3Gs with iOS 4.3.2, so it's difficult for us to determine if this is an operating-system-side issue.
Upvotes: 2
Views: 3830
Reputation: 79
I seen a lot of issues similar to you ,, this maybe help you
https://discussions.apple.com/thread/2499350?start=15&tstart=0
Too large an AJAX response for mobile safari?
jQuery Ajax Response: Works in Browser, Null on Mobile Device
Goodluck.! :)
Upvotes: -1
Reputation: 7234
Is it possible it's related to this issue: https://github.com/jquery/jquery-mobile/issues/2521? If so, the conclusion seems to be that it's an issue in that version of Safari.
Even if that bug isn't identical, you could try changing / removing the rel attribute of your link and disabling JQuery's pushState to narrow the problem down even further.
If you haven't already tried it, I'd suggest taking a local copy of the page and reducing its content as much as you can to try to find the minimal criminal, i.e. the smallest version of the page that still exhibits the problem.
Upvotes: 0