[英]Jquery dialog box not close after ajax success
function sendMsg(){
$.ajax({
beforeSend: function(){
$("#loading").dialog('open').html("<p>Please Wait...</p>");
},
url: "${pageContext.request.contextPath}/WhoopieeMerchantAppConversationList", //(dynamically generated by product item), //(dynamically generated by product item)
type: "get",
data:"to_userid="+document.getElementById('to_userid').value+"&store_id="+document.getElementById('store_id').value+"&merchant_id="+document.getElementById('merchant_id').value+"&msg="+document.getElementById('msg').value,
success: ajaxSuccessHandler
});
}
function ajaxSuccessHandler(obj) {
if(obj=="error")
{
$('#loading').html("<p style='font-size:18px;'>Msg Already Sent</p>");
}
else
{
$("#loading").dialog("close");
alert("Message Sent Successfully");
var redirect_link = document.getElementById('redirect').value;
setTimeout(function(){window.location.href=redirect_link},0);
}
}
我想在ajax调用后关闭对话框,但它仍显示在警报框的后面,请帮助
如果您不想将对话框重新用作模式对话框,请尝试以下操作
$("#loading").dialog("close");
setTimeout(function(){
alert("Message Sent Successfully");
window.location.href=document.getElementById('redirect').value;
},100)
或在对话框中创建有
close: function(){
alert("Message Sent Successfully");
window.location.href=document.getElementById('redirect').value;
},
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.