IPhoneApp This is part two of a three part series showing how to call the Force.com REST API from JavaScript in various scenarios. Part one, Calling the REST API from JavaScript in Visualforce Pages, explained how to call the REST API from JavaScript in the context of a Visualforce Page, while part three, Calling the REST API from JavaScript in PhoneGap, looks at JavaScript running in mobile apps on the PhoneGap framework.

You might recall my recent blog entry on Calling the REST API from JavaScript in Visualforce Pages; in it, I mentioned that my first pass at the problem involved running a simple PHP proxy, hosted, with my JavaScript, on a separate site. Although, as I mentioned before, this isn’t the best solution, since it requires a separate host, it was sufficiently interesting that I refactored the Force.com JavaScript REST Toolkit to allow ‘do-it-yourself’ hosting as an alternative, and modified the PHP proxy to mimic our AJAX Proxy.

Also, since I wrote that last blog entry, I have created a sample mobile app based on the excellent jQuery Mobile. I am incredibly impressed with how well jQuery Mobile works, particularly since it’s still at an alpha stage – it’s easy to create a really attractive mobile app that works across a range of browsers and platforms.

The code, and documentation, for all this is in the GitHub project. Go fork it and see what you can come up with!

Get the latest Salesforce Developer blog posts and podcast episodes via Slack or RSS.

Add to Slack Subscribe to RSS