我有以下ajax.actionlink: -Ajax.Actionlink OnBegin確認不會阻止被稱爲Ajax調用,如果用戶點擊「取消」按鈕
@Ajax.ActionLink("Delete", "Delete", "Answer",
new { id = answer.AnswersID },
new AjaxOptions
{
OnBegin = "deleteconfirmation1",
HttpMethod = "Post",
UpdateTargetId = @answer.AnswersID.ToString(),
OnSuccess = "deleteconfirmation",
})
及以下deleteconfirmation1.js應執行Ajax調用之前顯示確認消息: -
function deleteconfirmation1() {
jConfirm('Deletion Confirmation', 'Are you sure you want to delete this Answer');
}
,我現在面臨的問題是,onbegin confiramtion不會阻止的onSuccess腳本被執行,即使在取消按鈕,用戶點擊?所以我如何讓OnBegin作爲確認階段工作,所以應用程序將在用ajax調用進程之前等待用戶選擇「確定」或「取消」! ?? BR
我沒有使用AjaxOption.Confirm,因爲我想使用定製的Java腳本確認。第二件事刪除將被執行,即使JConfirm對話框仍然顯示之前選擇確定或取消,爲什麼我不認爲這是涉及到返回錯誤或不....... – 2012-03-10 19:36:34
試一試內置'確認'JS功能,因爲它應該工作。它連接'jConfirm'做確認異步,這就是爲什麼返回值似乎沒用。你能提供一個'jConfirm'的鏈接嗎? – nemesv 2012-03-10 19:46:06
感謝您的回覆;這裏是鏈接http://www.abeautifulsite.net/blog/2008/12/jquery-alert-dialogs/。關於提供內置確認,我不知道從哪裏我應該在腳本中調用buil在我的ajax.actionliknk – 2012-03-10 20:10:32