Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fix url using jquery mobile

I'm using jquery mobile to building a site but when I click on a button and this button points to a dialog page, in the URL appears #&ui-state=dialog. If I put in the <a data-ajax="false"></a> the url is correct without #&ui-state=dialog but the dialog window doesn't show correctly because obviously ajax is disable.there is some way to fix it?

like image 736
eng_mazzy Avatar asked Feb 16 '12 18:02

eng_mazzy


2 Answers

Try to use data-history="false" in the popup div tag like:

<div data-history="false" data-role="popup" id="options-list-div" data-theme="b" data-overlay-theme="b">

Good luck! :-)

like image 177
Eagle_one Avatar answered Sep 25 '22 05:09

Eagle_one


When you open the dialog, use $.mobile.changePage() and set the changeHash option to false: http://jquerymobile.com/demos/1.0.1/docs/api/methods.html

//delegate the event binding so elements in the DOM now and in the future will be bound-to
$(document).delegate('#my-dialog-button', 'click', function () {

    //change to the dialog, forcing the hash to remain the same and the page to be viewed as a dialog
    $.mobile.changePage($('#my-dialog'), {
        changeHash : false,
        role       : 'dialog'
    });
});
like image 39
Jasper Avatar answered Sep 22 '22 05:09

Jasper