jquery异步对话框
jquery
模式对话框是异步的吗?
$('.triage').click(function() {
$("#dialog-modal").dialog({
position: [175, 175],
draggable: false,
height: 140,
modal: true
});
});
$.ajax(
{
type: "POST",
data: [],
dataType: "json",
contentType: "application/json; charset=utf-8",
url: "ReferralAutoTriage.asmx/RunTriageReferrals",
success: function(response) {
$("#dialog-modal").dialog('close')
},
failure: function(response) {
}
});
});
如果对话框是同步的,我需要将其设为异步,这样我就可以在显示对话框时处理 ajax 调用,并在完成后关闭。谢谢。
Are the jquery
modal dialogs asynchronous?
$('.triage').click(function() {
$("#dialog-modal").dialog({
position: [175, 175],
draggable: false,
height: 140,
modal: true
});
});
$.ajax(
{
type: "POST",
data: [],
dataType: "json",
contentType: "application/json; charset=utf-8",
url: "ReferralAutoTriage.asmx/RunTriageReferrals",
success: function(response) {
$("#dialog-modal").dialog('close')
},
failure: function(response) {
}
});
});
If the dialog is synchronous I need to make it asynchronous, so I can process ajax call while displaying dialog and close after I am done with it. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用
beforeSend
/complete
事件来显示/隐藏对话框。Use the
beforeSend
/complete
events to display/hide your dialog.它认为你的意思是“阻塞”,而不是“同步”,在这种情况下 - 不,jQuery 模式对话框不是阻塞的。只有浏览器原生的
alert()
、confirm()
和prompt()
对话框可以执行此操作。您绝对可以处理打开模式对话框的 ajax 调用。
听起来您正试图找出代码不起作用的原因。通过 http://sscce.org" rel="nofollow">SSCCE 怎么样? /jsfiddle.net 或 http://jsbin.com?
It think you mean "blocking," not "synchronous," in which case - no, jQuery modal dialogs are not blocking. Only browser-native
alert()
,confirm()
, andprompt()
dialogs can do that.You can absolutely process ajax calls which a modal dialog is open.
It sounds like you're trying to figure out why your code isn't working. How about an SSCCE via http://jsfiddle.net or http://jsbin.com?