javascript - waitforelement - sharepoint 2013 rest api add list item

AJAX on the iPhone? (5)

I have seen reference to using Ajax as an 'sdk' for iPhone. AJAX on the iPhone? (read the response for a link to dev works)

I have a site that I've developed that makes decent use of Javascript, and minimal use of AJAX for a few things. The site worked fine on the iPhone until I added the function to create an HttpRequest handle at which point all Javascript on the iPhone now silently fails. So, I have a few questions.

(1) It seems that AJAX does not work at all on the iPhone. IS this true? If not, how can I modify the HttpRequest create function to accomodate the iPhone?

(2) If AJAX is indeed impossible on the iPhone, is there a way I can modify the function given so that it will fail gracefully on the iPhone, and other scripts on the page will still function?

(3) If this is not true, what do I need to do server side (and is this even possible?) do detect the iPhone, so that I can remove the AJAX code entirely when an iPhone requests the page?

What would also work quite nicely is the ability to use CSS to detect the iPhone as a display device, and act accordingly, similar to what you use with Opera Show. Of course, this wouldn't fix the AJAX issue, but it would be neat. ^_^

Thanks for answers. Several of my customers access the site regularly from the iPhone, and I want my pages to work as much as they possibly can, so I'm willing to modify my code for it, even though I don't have one to test on.

I recommend you open iTunes and view (and do the exercises of) the iPhone application development course from Stanford University on iTunes University.

Your PHP experience is not going to be that much help, but Objective C is a nice language and Cocoa a great framework.

You can of course run a web application on the iPhone, but unless the server runs locally (e.g. using Seaside on Smalltalk) you are going to have severe performance issues as the roundtrip time to the server is rather high on 3G.

One useful resource for troubleshooting JavaScript errors like this on the device is the debug console. It should report any parsing errors and can also be used to log messages and exceptions. You can turn it on from Settings > Safari > Developer (scroll to the bottom).

There's no reason AJAX wouldn't work on the iPhone, many of Google's sites/facebook etc use it perfectly well.

Does your AJAX work in Safari/Mac? That's the closest approximation you'll get in a non-mobile environment.

I would imagine there's some bug somewhere in your javascript that you're just not spotting

where to start developing iphone / mobile applications in php?

You can develop web services for the iPhone/iOS in PHP, either for a online web app that runs under Safari, or for inside an online application's UIWebView (see PhoneGap for an example).

But for developing a general purpose application that will run standalone and offline on an iPhone, you will most likely need to learn another programming language, such as Objective C or Javascript. And Objective C has the most complete API for using the iPhone's built-in features, such the video camera, gyros, etc.