jQuery UI对话框 – 第一次无法打开

我使用jQuery UI对话框作为确认框,当您单击链接时,对话框将打开问题和两个按钮。 但是我在对话框中遇到了一些负载问题。 当我第一次访问该页面时,该对话框将无法打开。 当我按F5并再次尝试时,它工作正常。

这是我的代码:

 $(document).ready(function() { var url; $( "#dialog" ).dialog( { autoOpen: false, resizable: false, modal: true, buttons: { "Yes": function() { $(this).dialog("close"); window.location.href = url; }, "No": function() { $(this).dialog("close"); } } }); $("a.supportClub").click(function(e) { e.preventDefault(); url = e.target; $("#dialog").dialog("open"); }); });  

The question

Support

希望能有人帮助我。

谢谢!

 $("a.supportClub").click(function(e) { e.preventDefault(); url = e.target; $('#dialog').dialog('destroy'); $("#dialog").dialog(); }); 

试试这个 :