[英]Display message in a popup box
我试图在更新表行后使用显示成功消息的jquery显示弹出框。
这是我正在尝试的代码:
$.ajax({
type: "POST",
url: "process.php",
dataType: 'html',
data: {
name: $('#name').val(),
address: $('#address').val(),
city: $('#city').val()
},
beforeSend: function(){$('#loading').show();},
success:function(data){
$('#manage_user table > tbody:last').find('tr:first').before(data);
$('#success').dialog({
autoOpen: false,
height: 'auto',
width: 350,
modal: true
});
setTimeout("$('#success').hide(); ", 3000);
},
error:function (xhr, ajaxOptions, thrownError){
alert(thrownError);
},
complete: function(){
//alert('update success');
}
});
但是我的问题是更新完成后,此消息没有显示为弹出窗口。
这是我的HTML-
<div id="success" title="Hurray,">
<p>User table is updated.</p>
</div>
谁能告诉我我要去哪里错了? 谢谢。
尝试删除此行
autoOpen: false,
从官方文件
自动打开
默认值:true
如果设置为true,则对话框将在初始化时自动打开。 如果为false,则对话框将保持隐藏状态,直到调用open()方法为止。
编辑
将您的setTimeout
更改为此
setTimeout("$('#success').dialog('close');", 3000);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.