我有两个框架,一个在左边,用于搜索右边另一个框架中字段的内容。我为对话框创建的#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');
答案 0 :(得分:0)
事实证明,这只是一个不以父级别领先的方式访问它的问题。坦克寻找!修复:
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
});