我在控制器中有一个动作
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" />
它的作用是执行数据库查询,然后使用成功消息重定向到主页。
所以我需要 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 调用它有什么区别?