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