There is an action in a controller that I need to modify.
def deleteFiling={
obj.removeFiling()
redirect(action:"list")
}
This action is triggered from a GSP:
<g:link action="deleteFiling" id="${filingInstance.id}"> <img src="${resource(dir:'images',file:'trash.gif')}" title="Delete" />
When this action is called, it performs a database query and then redirects to the main page with a success message.
However, I now want the GSP to call a different action that involves some JavaScript functionality like displaying a popup confirmation message before executing the deleteFiling action.
I am attempting something using Ext JS:
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
});
}
The issue I am facing is that when I use an ajax call to trigger the action, the database query is executed but the redirection does not happen.
On the other hand, when I directly call the action from the GSP, the redirection works fine. I am wondering what could be causing this difference between calling an action through an ajax call from JavaScript versus calling it directly from the GSP?