Jquery UI 对话框无法访问另一个框架

发布于 2024-10-09 19:33:20 字数 785 浏览 0 评论 0原文

我有两个框架,一个在左侧,它搜索右侧另一个框架中的字段内容。我为对话框创建的#matchesFound div 位于右侧的搜索框架上。但是,执行搜索并加载模式的 JavaScript 位于左侧框架中。最终结果是对话框加载到左框架而不是右框架上。

有没有办法强制 jquery UI 对话框在特定框架中打开?由于解释编辑,一些示例不稳定,但 ajax 返回和序列化工作正常。

var criteriaPage =  parent.leftSide.document;
var searchPage   =  parent.rightSide.document;
var postData     =  $(searchPage   ).serialize(); 
var matchesFound =  searchPage.getElementById('matchesFound');

var count = 
      $.ajax({        
        type: "POST",
        url: "ajax.url.php",
        data: postData,
        async: false
      }).responseText;

$(matchesFound).html(count);
$(matchesFound).dialog({
    autoOpen: true,
    position: [350,100],
    height: 250,
    width: 400,
    modal: true
});
$(matchesFound).dialog('open');          

I have two frames, one on the left which searches the content of the fields in the other frame on the right. My #matchesFound div created for the dialog resides on the search frame on the right. However, the javascript that performs the search and loads the modal is on the left frame. The ending result is that the dialog is loaded on the left frame instead of the right.

Is there a way to force a jquery UI dialog to open in a specific frame? Some of the example is shaky due to explanation edits, the ajax return and serialization works fine.

var criteriaPage =  parent.leftSide.document;
var searchPage   =  parent.rightSide.document;
var postData     =  $(searchPage   ).serialize(); 
var matchesFound =  searchPage.getElementById('matchesFound');

var count = 
      $.ajax({        
        type: "POST",
        url: "ajax.url.php",
        data: postData,
        async: false
      }).responseText;

$(matchesFound).html(count);
$(matchesFound).dialog({
    autoOpen: true,
    position: [350,100],
    height: 250,
    width: 400,
    modal: true
});
$(matchesFound).dialog('open');          

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

烟雨凡馨 2024-10-16 19:33:20

事实证明,这只是一个无法在父级领导下访问它的问题。坦克寻找!修复:

 var searchFrame  = parent.right;
var searchForm       = parent.sch_input.document.forms["openHouseSearch"];
var searchCriteria   = $(searchForm).serialize();
var matchesFound      =  parent.right.document.getElementById("matchesFound");

var count = 
         $.ajax({        
            type: "POST",
            url: "ajax.url.php",
            data: ohsData,
            async: false
         }).responseText;
searchFrame.$(matchesFound).html(count);
searchFrame.$(matchesFound).dialog({
    autoOpen: true,
    height: 250,
    width: 400,
    modal: false
});

It turns out, this was just an issue of not accessing it with a parent level leading. Tanks for looking! The fix:

 var searchFrame  = parent.right;
var searchForm       = parent.sch_input.document.forms["openHouseSearch"];
var searchCriteria   = $(searchForm).serialize();
var matchesFound      =  parent.right.document.getElementById("matchesFound");

var count = 
         $.ajax({        
            type: "POST",
            url: "ajax.url.php",
            data: ohsData,
            async: false
         }).responseText;
searchFrame.$(matchesFound).html(count);
searchFrame.$(matchesFound).dialog({
    autoOpen: true,
    height: 250,
    width: 400,
    modal: false
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文