当我加载/test/anycontent.php 的内容时
<div>
<h1>My title</h1>
<p>This is a paragraph</p>
<script type="text/javascript">
// alert("it seems that the presence of script tags is enough to trigger the problem");
</script>
</div>
进入 jquery ui 对话框,使用 $.post 方法的结果是错误的,
并使用加载方法进行清洁。
这是使用 post 方法的测试
$("#test").click(function(e){
$.post(url, {}, function(data){
$(data).dialog();
});
});
这里使用 get 方法进行测试
$("#test").click(function(e){
$("<div></div>").load(url).dialog();
});
然后我的问题是使用 post 方法,
我将有 2 个 ui-dialog 实例!!
只有一个是预期的,另一个就在第一个的中间,
它是空的和封闭的。
你知道为什么吗 ?
你知道这个问题吗?
笔记:
已订票
http://bugs.jqueryui.com/ticket/6887
最佳答案
你的 div 设置太笼统了。尝试使用具有以下 ID 的 div:
$('#someDiv').dialog() 调用您的对话框。
然后在对话框选项中关闭事件:
每次只打电话
关闭:函数(){
$('#someDiv').empty()
}
关于jquery-ui - jquery ui 对话框 : triggered twice with emebedded script tag problem,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4766367/