You can manually capture the required item:
//delegate the event binding for some link(s) $(document).delegate('a.my-link', 'click', function () { //show the loading spinner $.mobile.showPageLoadingMsg(); //make the AJAX request for the link href attribute $.ajax({ url : this.href, success : function (serverResponse) { //get the data-role="page" elements out of the server response var $elements = $(serverResponse).find('[data-role="page"]'); //you can now access each `data-role="page` element in the `$elements` object $elements.filter('#page-id').appendTo('body'); //now use changePage to navigate to the newly added page $.mobile.changePage($('#page-id'), { /*options*/ }); //hide the loading spinner $.mobile.hidePageLoadingMsg(); }, error : function (jqXHR, textStatus, errorThrown) { /*Don't forget to handler errors*/ } }); //stop the default behavior of the link, also stop the event from bubbling return false; });
But I have to say that with the way jQuery Mobile works, you better place each data-role="page" element in a separate document.
source share