jquery ui dialog : triggered twice with emebedded script tag problem
When I load the content of /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>
into jquery ui dialog, the result is buggy using the $.post method, and clean using the load method.
Here is the test with post method
$("#test").click(function(e){
$.post(url, {}, function(data){
$(data).dialog();
});
});
And here the test with get method
$("#test").click(function(e){
$("<div></div>").load(url).dialog();
});
Then my problem is that with the post method, I will have 2 instances开发者_如何转开发 of ui-dialog !! only one was expected, the other is just in the middle of the first one, and it is empty and closed.
Do you know why ? Do you know issues for this ?
Note: a ticket has been set http://bugs.jqueryui.com/ticket/6887
Your div setup is too generic. Try using a div with an id like:
$('#someDiv').dialog() to call your dialog on.
Then on close event in dialog options:
each time just call
close: function(){
$('#someDiv').empty()
}
精彩评论