I’m working on a jQuery Mobile site but we’re not using the AJAX transitions (we have $.mobile.ajaxEnabled = false for the entire site).
I have a page that I would like to be treated like a dialog however, this only appears to work with AJAX enabled.
Has anyone found a way to get jQuery Mobile to treat a page like a dialog in this way short of just designing a page that looks like a dialog?
The jQuery Mobile framework displays the first
data-role="page"element found in the document, it skipsdata-role="dialog"elements so you cannot let the first pseudo-page in a document be a dialog (dialogs are skipped on the initial load).You can however insert a pseudo-page into the DOM manually and then use
$.mobile.changePage()to show the newly inserted page as a dialog:Here is a demo: http://jsfiddle.net/mVdVd/
Note that
serverResponseis expected to be a fully formed HTML code-block that starts with adata-role="dialog"element (that has the Id ofdialog-id).