Jquery ui jQueryUI对话框按钮出现问题
在我的网站上,我有一个按钮,当点击该按钮时,会打开一个对话框,其中包含一个已填充的表单,用于发送电子邮件。在这个表单中,我有一个名为“invia”的按钮来发送邮件,邮件发送正确,但不起作用的是在发送电子邮件后关闭对话框。这里附上了我的代码: 提前谢谢你的帮助Jquery ui jQueryUI对话框按钮出现问题,jquery-ui,modal-dialog,Jquery Ui,Modal Dialog,在我的网站上,我有一个按钮,当点击该按钮时,会打开一个对话框,其中包含一个已填充的表单,用于发送电子邮件。在这个表单中,我有一个名为“invia”的按钮来发送邮件,邮件发送正确,但不起作用的是在发送电子邮件后关闭对话框。这里附上了我的代码: 提前谢谢你的帮助 $("#invio_mail").live("click", function() { if (m=="") //that's to prevent multiple dialog opening { $.post("./php/
$("#invio_mail").live("click", function() {
if (m=="") //that's to prevent multiple dialog opening
{
$.post("./php/testo_mail_xml.php",
{contratto:contratto, piatta:piatta, testo:"stampa_login"},
function(xml)
{
if ($(xml).find("status").text()==1)
{
$("#ris_dial").load("./schemi/sch_mail.htm");
delay( function() { //that's a function for delay population
scorriDati(xml, "forMail"); //that's function for populate
}, 500);
var dm = {
modal: true,
height: 'auto',
width: 'auto',
title: "<span class='ui-icon ui-icon-info'></span> Invio Mail",
closeOnEscape: false,
buttons: {"Invia": function() {
$.post("./php/mail.php",
{dati:$("#forMail").serialize()},
function(xml)
{
if ($(xml).find("status").text()==1)
{
//var opt={close:true};
//$("#ris_dial").dialog(opt);
$(this).dialog("close"); //this is not wrking code
}
else
$(this).append($(xml).find("errore").text());
},"xml"
);
}
}
};
$("#ris_dial").dialog(dm);
}
else
{
$("#ris_dial").empty().append($(xml).find("errore").text());
$("#ris_dial").dialog(dialogError);
}
},
"xml"
);
m++;
}
});
$(“#因维奥邮件”).live(“单击”,函数(){
if(m==“”)//这是为了防止多个对话框打开
{
$.post(“./php/testo_mail_xml.php”,
{contratto:contratto,piatta:piatta,testo:“stampa_login”},
函数(xml)
{
if($(xml).find(“status”).text()==1)
{
$(“#ris#dial”).load(“./schemi/sch#u mail.htm”);
delay(function(){//这是一个用于延迟填充的函数
scorriDati(xml,“forMail”);//这是用于填充的函数
}, 500);
var dm={
莫代尔:是的,
高度:“自动”,
宽度:“自动”,
标题:“因维奥邮件”,
closeOnEscape:错误,
按钮:{“Invia”:函数(){
$.post(“./php/mail.php”,
{dati:$(“#forMail”).serialize()},
函数(xml)
{
if($(xml).find(“status”).text()==1)
{
//var opt={close:true};
//$(“ris拨号”)对话框(可选);
$(this.dialog(“close”);//这不是编写代码
}
其他的
$(this.append($(xml.find(“error”).text());
},“xml”
);
}
}
};
$(“ris拨号”)对话框(dm);
}
其他的
{
$(“#ris_dial”).empty().append($(xml.find(“error”).text());
$(“#ris#U拨号”)。对话框(dialogError);
}
},
“xml”
);
m++;
}
});
此的上下文在$.post()内部发生更改。
在调用post
之前,请保存此
:
var $this = $(this);
并将您的呼叫更改为close
:
$this.dialog("close")
您想关闭对话框,还是不想关闭?您的对话框不清楚question@Devjosh:感谢您在我获得状态==1(正确发送电子邮件)并关闭该对话框时回答我想要的问题。