[英]Display message in a popup box
I am trying to display popup box using jquery showing a success message after updating the table row. 我试图在更新表行后使用显示成功消息的jquery显示弹出框。
This is code that I am trying : 这是我正在尝试的代码:
$.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');
}
});
But my problem is after update finished this message is not display as a popup. 但是我的问题是更新完成后,此消息没有显示为弹出窗口。
This is my HTML - 这是我的HTML-
<div id="success" title="Hurray,">
<p>User table is updated.</p>
</div>
Can anybody tell me where I am going wrong? 谁能告诉我我要去哪里错了? Thank you.
谢谢。
Try removing this line 尝试删除此行
autoOpen: false,
From official documentation 从官方文件
autoOpen
自动打开
Default: true
默认值:true
If set to true, the dialog will automatically open upon initialization.
如果设置为true,则对话框将在初始化时自动打开。 If false, the dialog will stay hidden until the open() method is called.
如果为false,则对话框将保持隐藏状态,直到调用open()方法为止。
EDIT 编辑
Chage your setTimeout
to this 将您的
setTimeout
更改为此
setTimeout("$('#success').dialog('close');", 3000);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.