简体   繁体   中英

jQueryMobile close dialog WITHOUT page refresh

Though this question is asked previously but their is no workaround suggested. I have a form and on the click of check box I want to open a popup/dialog and want user to enter some data in the popup/dialog, but when dialog/popup is closed my parent page looses all data, as it is reloaded. Can you please help me to achieve same.

The popup widget of JQuery mobile will compare current url to the original one and refresh the page if they aren't match. So, if you want to prevent this behavior, you have to avoid the popup widget affecting the history. Just add data-history="false" to your widget. However I am not sure about dialog widget because it is totally different from popup. Hope it helps.

If you use data-rel="back", you need to remove it. After this, I think you need to add this action to the close button on dialog.

$('yourButton').click(function(){
    $('yourDialog').popup('close');
});

它可以使用SimpleDialog2 http://dev.jtsage.com/jQM-SimpleDialog/来完成,但它不是那么先进,gui似乎在一些分辨率上失真。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM