Reload Jquery UI Parent Dialog

怎甘沉沦 提交于 2019-12-11 10:52:15

问题


All,

When I click a link on a web page, a JQuery UI Dialog opens up and it loads some ajax content into it. If I click a link inside this dialog, it opens up a child dialog. When I click "OK" in the child dialog, I want the child dialog to close and refresh the ajax content in the parent dialog.


回答1:


Do you already have the code that closes the child dialog ? Is it an alert() call ? If so, simply add a

        location.reload();

after the alert call. If it's something more complicated like a link, try

$('a.link-that-closes-dialog').click(function(){
  //Code to close the dialog
  location.reload();
 });



回答2:


i use this script for choose if show/hide any content. After clicking button "Ritira" in the dialog, the page redirect me in the same page but whit a querystring (ex. www.mypage.ext?t=yes). The script work, but I wish at the click of the button "Check Out" there is a refresh of the page. I tried to enter the location.reload but did not work:

        $(function() {
         $(document).ready(function() {
            $(".dialog-ritira").dialog({
              autoOpen: false,
              modal: true
            });
          });

          $(".ritira").click(function(e) {
            e.preventDefault();
            var targetUrl = $(this).attr("href");

            $(".dialog-ritira").dialog({
              buttons : {
                "Ritira" : function() {
                  window.location.href = targetUrl;
                  location.reload();
                },
                "Annulla" : function() {
                  $(this).dialog("close");
                }
              }
            });

            $(".dialog-ritira").dialog("open");
          });
        });

Thanks



来源:https://stackoverflow.com/questions/2290619/reload-jquery-ui-parent-dialog

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!