function AddScheduledCandidate() {
if (ValidateScheduledCandidate()) {
InsertGoogleEvent($('#comment').val(), $('#SchDateTime').val());
$.post(WebsiteURL + 'VideoRepository/AddScheduledCandidate', { id: $('#hdnId').val() }, "json")
.done(function (response) {
window.location.href = response.Url;
})
}
}
上面代码中的问题是我的页面在插入google日历信息之前被重定向。这是因为我知道jQuery代码不会逐行执行,并且在完成Google日历事件之前,重定向代码被触发并且Google日历记录未被插入。 任何帮助将不胜感激。从MVC调用jquery函数操作方法
谢谢
你可以发布insertgoogleevent代码吗? – 2015-02-07 07:26:01
标题和问题似乎是矛盾的:) – 2015-02-07 07:42:56
我写了这个标题,因为如果我可以从mvc action调用javascript,那么在脚本执行完成之前,页面重定向不会发生。 – 2015-02-17 06:35:21