jQuery用户界面对话框-赢得';I don’我第一次没打开
我使用jQueryUI对话框作为确认框,当您单击链接时,对话框将打开问题和两个按钮。 但是我的对话框有一些负载问题。当我第一次访问页面时,对话框不会打开。当我按F5并重试时,它工作正常 这是我的代码:jQuery用户界面对话框-赢得';I don’我第一次没打开,jquery,jquery-ui,caching,dialog,Jquery,Jquery Ui,Caching,Dialog,我使用jQueryUI对话框作为确认框,当您单击链接时,对话框将打开问题和两个按钮。 但是我的对话框有一些负载问题。当我第一次访问页面时,对话框不会打开。当我按F5并重试时,它工作正常 这是我的代码: <script type="text/javascript"> $(document).ready(function() { var url; $( "#dialog" ).dialog( { autoOpen: false, resizable: false,
<script type="text/javascript">
$(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");
});
});
</script>
<div id="dialog" title="Support club" style="display: none">
<p>The question</p>
</div>
<a href="?supportClub=5" class="button right supportClub">Support</a>
$(文档).ready(函数(){
var-url;
$(“#dialog”)。dialog({
自动打开:错误,
可调整大小:false,
莫代尔:是的,
按钮:{
“是”:函数(){
$(此).dialog(“关闭”);
window.location.href=url;
},
“否”:函数(){
$(此).dialog(“关闭”);
}
}
});
$(“a.supportClub”)。单击(功能(e){
e、 预防默认值();
url=e.target;
$(“对话框”)。对话框(“打开”);
});
});
问题
希望有人能帮助我
谢谢大家! 试试这个:
$("a.supportClub").click(function(e) {
e.preventDefault();
url = e.target;
$('#dialog').dialog('destroy');
$("#dialog").dialog();
});
<script type="text/javascript">
$(document).ready(function() {
function showDialog(url){
$( "#dialog" ).dialog( {
resizable: false,
modal: true,
buttons: {
"Yes": function() {
$(this).dialog("close");
window.location.href = url;
},
"No": function() {
$(this).dialog("destroy");
}
}
});
}
$("a.supportClub").click(function(e) {
e.preventDefault();
showDialog(e.target);
});
});
</script>
$(文档).ready(函数(){
函数显示对话框(url){
$(“#dialog”)。dialog({
可调整大小:false,
莫代尔:是的,
按钮:{
“是”:函数(){
$(此).dialog(“关闭”);
window.location.href=url;
},
“否”:函数(){
$(此).dialog(“销毁”);
}
}
});
}
$(“a.supportClub”)。单击(功能(e){
e、 预防默认值();
showDialog(如目标);
});
});