-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
jQuery Mobile Cookbook
By :
Whenever possible, the jQuery Mobile framework automatically uses Ajax for handling link clicks and form submissions. This can be configured using the $.mobile.ajaxEnabled property, which has a Boolean value of true by default. If Ajax is disabled or if its not supported, then an ordinary HTTP request is used and a full page load occurs. URL hash listening is also disabled. This recipe shows you how to configure the $.mobile.ajaxEnabled property.
Copy the full code of this recipe from the code/07/ajax-enabled sources folder. You can launch this code using the URL: http://localhost:8080/07/ajax-enabled/main.html.
In main.html, add the following script before including jquery.mobile.js:
$(document).bind("mobileinit", function() {
$.mobile.ajaxEnabled = true;
});Create the main page with a link to open page1.html:
<div id="main" data-role="page" data-theme="e">
<div data-role="header" data-theme="a">
<h1>Ajax Enabled...
Change the font size
Change margin width
Change background colour