O'Reilly logo

jQuery and JavaScript Phrasebook by Brad Dayley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Loading Mobile Pages without Displaying Them

<$.mobile.loadPage("newPage.php",   {data=$("form").serialize(), type="post"});

Another helpful function is .loadPage(URL, options). It downloads the mobile page from the web server using an AJAX call but does not change the mobile page to the downloaded one. Actually, .changePage() calls .loadPage() underneath to retrieve the page. Most of the options listed in Table 14.3 are also available via .loadPage(), except changeHash, dataUrl, reverse, and transition.

The .loadPage() function is useful for preloading pages in the initialization functions that you want available later but do not want to display yet. The following code shows an example of loading a page using ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required