行動我有一個控制器調用的Grails從JavaScript VS GSP
def deleteFiling={
obj.removeFiling()
redirect(action:"list")
}
被調用形式的GSP一個動作:
<g:link action="deleteFiling" id="${filingInstance.id}"> <img src="${resource(dir:'images',file:'trash.gif')}" title="Delete" />
和它做什麼,它執行DB查詢,然後用成功消息重定向到主頁面。
所以我需要gsp來調用一個不同的動作,它執行一些JavaScript工作,如彈出式確認消息,一旦它完成,它會調用該動作deleteFiling並執行它。
所以我做這樣的事情在ExtJS的:
Ext.MessageBox.show({
title:'Commit Confirmation',
msg: 'You are about to <strong>Delete</strong> the entire <strong>Filing</strong>. This \n action cannot be reversed within the form PF application. \n\nAre you sure you want to Proceed',
buttons: Ext.MessageBox.YESNO,
fn: processDelete,
icon: Ext.MessageBox.QUESTION
});
function processDelete(btn, text){
$.ajax({
url : appContextRoot + '/filing/deleteFiling'
//success:mySuccessFunction
});
}
,我遇到的問題是,當我打電話,通過Ajax調用動作時,查詢被執行,但重定向不
但是當我直接從gsp調用動作時,重定向就起作用了。 我的問題是調用使用來自java腳本的ajax調用並直接從gsp調用它的動作之間的區別是什麼?