Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

UIWebView & Safari mobile screw up jQuery ajax calls after user interaction

I have an asp.net web service (aspx), which I am calling methods of through a website using jQuery Ajax; thusly:

$.ajax({
type: "POST",
url: "WebService.asmx/GetValues",
data: "{'VersionIndex': " + VersionIndex + "'}",
contentType: "application/json; charset=utf-8",
dataType: "xml",
success: function (response) { UpdateControls(response); },
error: function (response, status, errorthrown) {
calling = false;
connectionInterrupted = true;
DataRoutine = window.setTimeout(DataService, dataFrequency); }
});

I've created a thin client app which uses a UIWebView to display this website.

Sometimes, after touch interactions (zooming/panning) the ajax calls stop working. The error method gets called, but the three parameters are undefined.

These failures continue after user interaction has stopped, from between 30s and 3min usually.

Can anyone explain what the problem may be or if this is a bug?

My workaround has been to detect that the client is an iPhone in the pages initialisation script and instead do the web service calls manually via an NSURLConnection, and pass the resulting XML back into the web page using [webView stringByEvaluatingJavascriptFromString:]. It works but isn't ideal.

I should add that Safari mobile also has the same problem. Safari for Mac/Windows, and other web browsers don't though.

Message was edited by: Tobster86

iPhone/iPod touch, iOS 4

Posted on Jan 17, 2011 7:00 AM

Reply

There are no replies.

UIWebView & Safari mobile screw up jQuery ajax calls after user interaction

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.