Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

jQuery Mobile and JSON

Learn how to create mobile web applications powered by jQuery Mobile

Frank Ableson, Entrepreneur, Navitend
W. Frank Ableson is an entrepreneur living in northern New Jersey with his wife Nikki and their children. His professional interests include mobile software and embedded design. He is the author of Unlocking Android (Manning Publications, 2009) and Android in Action (Manning Publications, 2011) and he is the mobile editor for Linux Magazine.

Summary:  jQuery powers many of the sites on the Internet today, providing dynamic user experience in the browser and helping to make traditional desktop applications increasingly rare. Now that browsers found on the major mobile platforms have caught up to desktop browser functionality, the jQuery team has introduced jQuery Mobile, or JQM. The mission of JQM is to bring a universal experience to all major mobile browsers, enabling rich content across the Internet, regardless of the viewing device. This tutorial examines fundamental design concepts around jQuery Mobile in the context of a sales force automation-oriented application. You create an intuitive and visually appealing mobile web application that interacts with an Internet-hosted website to store and manage sales opportunities.

Date:  01 Mar 2011
Level:  Intermediate PDF:  A4 and Letter (945 KB | 40 pages)Get Adobe® Reader®

Activity:  111231 views
Comments:  

Before you start

Frequently used acronyms

  • Ajax: Asynchronous JavaScript + XML
  • ASP: Active Server Pages
  • CSS: Cascading Stylesheets
  • DOM: Document Object Model
  • FTP: File Transfer Protocol
  • GPL: GNU General Public License
  • HTML: HyperText Markup Language
  • HTTP: Hypertext Transfer Protocol
  • MIT: Massachusetts Institute of Technology
  • SQL: Structured Query Language
  • UI: User interface
  • XML: Extensible Markup Language

To get the most from this tutorial you should be comfortable constructing web applications with HTML, JavaScript, and CSS. Additionally, the server-side code accompanying the mobile web application is written in PHP and MySQL. Familiarity with server-side programming can also help you as you follow along with this tutorial. If you are familiar with other server-side platforms such as ASP classic, ASP.Net, or Java™ Server Pages, you can find the server-side code quite easy to follow. Familiarity with jQuery is not necessary but, of course, will not hurt. In fact, this tutorial is written from the perspective of a mobile programmer looking to explore a new framework rather than from that of a jQuery professional launching into the mobile space. After completing this tutorial, you will have learned how to construct a basic jQuery Mobile application and manage data between the mobile browser and a back-end server. The application demonstrates how to perform basic record operations such as (insert, update, delete) on sales-related data. You also witness how universal your mobile web application is as you run it from multiple browsers. Last, you install shortcuts to your mobile web application to the home screen of both iPod and Android devices to demonstrate how to deploy a web application.

About this tutorial

This tutorial introduces the jQuery Mobile (JQM) framework for writing mobile web applications targeted at the mobile industry's leading browsers. JQM is used to provide intuitive and consistent user experience for web-based applications running on mobile devices such as iPhone, iPad, Android, WebOS, BlackBerry Version 6 (Torch, Playbook), and others. The tutorial begins with a high-level look at the JQM project and the relation of JQM to, and dependence on, HTML5. After a brief look at one of the many ways in which you can construct a JQM application and some of the ways in which JQM enhances fundamental web UI elements, the tutorial takes a look at a basic sales force automation requirement.

With the problem in hand, the tutorial maps out a plan to implement a solution for mobile device users, without the need for native mobile development. The completed application is demonstrated so that you can get a feel for where the tutorial will take you as you follow along and build your own application, step by step. The source files are examined, function by function, as you learn to implement the solution using JQM. The tutorial concludes with a couple of tricks on making the application easy for your users to access on their mobile devices.


Prerequisites

To follow this tutorial, you need the following:

  • Text editor—You can use any text editor you prefer. An editor with syntax highlighting might come in handy. Notepad++ is an open source editor that works well.
  • JQuery Mobile links—You actually do not need to download anything. The necessary files are available through jQuery's Content Delivery Network (CDN).
  • Web browser—This browser is used to view the jQuery Mobile help and documentation.
  • WebKit (Safari) or Chrome Browser—These browsers support jQuery Mobile development on the desktop.
  • Mobile device—You can use the iPod Touch, Android, BlackBerry Torch, or similarly capable mobile devices.
  • PHP and MySQL hosting environment—This is used for the server side of the application

I created the code samples for this tutorial on a MacBook Pro with VMWare Fusion running Windows® 7. I use Notepad++ for editing the files because it has good syntax highlighting plus secure FTP for making interacting with server-based PHP files very straightforward. You can edit files in vi, but who wants to? For working with the MySQL database, I used the phpMyAdmin available with my hosting account. For testing on a physical device, I used a Nexus One running Android 2.2 and an iPod Touch running iOS 4.1.

See Resources for helpful links; download the source code for the sample application.

1 of 7 | Next

Comments



Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=XML, Open source, Web development
ArticleID=629530
TutorialTitle=jQuery Mobile and JSON
publish-date=03012011
author1-email=fableson@navitend.com
author1-email-cc=nancy_hannigan@us.ibm.com

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Try IBM PureSystems. No charge.