【发布时间】:2016-11-30 20:28:28
【问题描述】:
我有一个按钮:
<button type="button" class="btn btn-primary mt15 send-emails" name="SendEmails" value="true">Send Emails</button>
还有一个方法:
$('.send-emails').click(function (e) {
// build data and other stuff
$.post('/leads/sendemails', data, function (data, status, xhr) {
alert('Emails have successfully been queued for sending.');
window.onbeforeunload = null;
window.location.href = '/Leads/Lead/' + @Model.LeadID;
}, 'json');
});
即使使用window.onbeforeunload = null;,我仍然会收到弹出警告:
如何防止这种情况发生?
【问题讨论】:
-
请试试这个:
$(window).unbind(); -
成功了!将其列为答案?
标签: javascript jquery navigation