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, the calls work beautifully. Problem is, as soon as we test on the iPhone emulator, or on the actual device, we are not getting anything back from the web service.
I have turned on the 'Develop' menu and changed the 'User Agent' to Mobile Safari to see if that makes a difference, but it still works on the PC side of things.
I don't think it is a cross site restriction, as all the ajax calls etc. are made from the same server and port number.
Is there a way we can do javascript debugging on the emulator to see where the call is failing?
Thanks, Devan
I ran into the same problem.
Check the url: parameter in the object you send to the jQuery.ajax function. Shorten it from "http://the/full/url" to "/just/the/relative/to/root/part"
To me, it seems like a Safari Mobile bug.
You can enable the javascript console in Mobile Safari. See the instructions here. It's basically Settings->Safari->Developer->Debug Console. This works on the emulator, and the actual device.
I had the same problem writing an AJAX chat for a website. The problem is the cache. Add this line of code and the problem is solved.
$.ajaxSetup({ cache: false });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With