jQuery Mobile Developer Guide

JSON fueled, delivered by Cloud CMS

jQuery Mobile is a unified, open source framework for building rich, interactive HTML5-based mobile user interfaces that run on all popular mobile device platforms. It's build on the trusted and reliable jQuery and jQuery UI JavaScript foundation libraries.

The jQuery Mobile codebase is lightweight, supports progressive enhancement, and has a flexible, easily themeable design.

Cloud CMS provides the ideal cloud backbone for your jQuery Mobile applications that empowers your applications with services like data modeling, query/traversals, full-text search, mimetype transformations, data extractors, email, auditing, and more.

Sign up for Cloud CMS

If you already have a Cloud CMS subscription, you can skip ahead.
Otherwise, be sure to sign up for a trial account first, in order to use Cloud CMS.

API Keys

Every mobile app or web site that you build will need to have a set of API Keys that it will use to connect to your Cloud CMS platform on behalf of your code. These API keys consist of client and user key/secret pairs.

  1. Log in to your Cloud CMS tenant at https://<yourdomain>.cloudcms.net
  2. From Manage Platform -> API Keys

You will now see your API Keys for all of your platform's Application instances.
You can create as many Application instances as you'd like and each will have their own set of API Keys.

For more information, visit Configuring your API Keys.

Getting Started

Step 1: Download the Cloud CMS JavaScript driver

The Cloud CMS JavaScript driver handles all of the HTTPS calls, data conversions, OAuth2 authorization handshakes and any and all interaction with the Cloud CMS platform in a secure manner.

To get the latest version of the driver, please visit the JavaScript Driver for Cloud CMS page.

The driver comes as a single JS file that you can drop into your project. You can use either the minified or the uncompressed version (which is better, if you're debugging). It's up to you.

Step 2: Set up web server proxy

If we want to run our Cloud CMS powered jQuery Mobile app as a pure HTML5/JavaScript application, we will need to place it under a web server such as Apache web server.

Due to the cross domain limitation of ajax calls, we will need to setup a reverse proxy that forwards HTTP/HTTPS request “/proxy/*” to “http://api.cloudcms.com:80/*”.

Here is a sample Apache configuration file (replace server name, server alias and other
directories with your own settings).

<VirtualHost *:80>
RewriteEngine On
RewriteRule .* - [E=host:%{HTTP_HOST}]
ProxyRequests Off
ProxyPassInterpolateEnv On
ProxyPass /proxy http://api.cloudcms.com interpolate
ProxyPassReverse /proxy http://api.cloudcms.com interpolate
ProxyPassReverseCookieDomain api.cloudcms.com interpolate
<Directory />
Options -Indexes
AllowOverride All

Place the above custom configuration file in your Apache conf directory and restart the
Apache server.

Step 3: Hello World

Let us first build a simple Hello World application (click here to download the full project).

1) Create a simple HTML5/JavaScript project with the Cloud CMS JavaScript driver and all required jQuery Mobile library files.

2) Create a HelloWorld.js file. It will first create an instance of Cloud CMS driver that makes connection to to your Cloud CMS platform using the provided credentials. Once the connection is made, it will then print out the name of the authenticated user.

$(document).bind('pageinit', function() {
new Gitana({
"clientId" : "676e3450-6131-46c2-99cc-496aa2ad80fa",
"clientSecret" : "......"
"username" : "demo",
"password" : "demo"
}).then(function() {
var authInfo = this.getDriver().getAuthInfo();
var name = authInfo.getPrincipalName();
$('.content-primary h1').html('Hello '+name+'! Welcome to Cloud CMS!');

3) Create a hello-world.html file with links to the Cloud CMS JavaScript driver, jQuery Mobile library and the HelloWorld.js file.

<!DOCTYPE html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Hello world example that shows
how to connect to Cloud CMS using Cloud CMS JavaScript driver and
jQuery Mobile framework.">
<title>Cloud CMS - jQuery UI Mobile Framework - Hello World</title>
<link rel="stylesheet"
<link rel="stylesheet" href="../css/cloudcms.css" />
<script src="../lib/thirdparty/jquery/jquery.js"></script>
<script src="../lib/thirdparty/jquery/jquery.mobile-1.1.1.js">
<script src="../lib/cloudcms/js/gitana.js"></script>
<script src="../js/basic/HelloWorld.js"></script>
<div data-role="page" class="type-index">
<div data-role="header" data-theme="a">
<h1>Cloud CMS jQuery Mobile Examples - Hello World</h1>
<a href="../index.html" data-icon="home" data-iconpos="notext"
<div data-role="content">
<div class="content-primary">
<div data-role="footer" class="footer-examples" data-theme="c">
<p>Copyright &copy; 2012 Gitana Software | All Rights Reserved</p>

4) Open the hello-world.html with your browser and we should have a screen which looks like this.

You can find more advanced examples from here.
All source code of the examples can be downloaded from

GitHub Project for Cloud CMS jQuery Mobile Examples

To learn more about using Cloud CMS JavaScript driver, you can also check out our documentation site and hosted online samples.