So, I've got a link on a page which calls a little jQuery function, which in turn posts to a controller, the controller just runs some SQL before refreshing the page.
All this works nicely, while debugging it with lots of alerts etc to make sure things are doing what I want. BUT, once I remove all the alerts it stops working?! Any ideas? You can see the commented out alert in the function below, commented out nothing happens, no SQL update, nothing. If I add that alert back in it then works fine?!
Has anyone ever come across this or found a way around it? Is there a way/obvious reason why this is happening? Cheers!
jQuery function
function reQueueTest(url, id){
$.post(url, { id:id },function(data){
});
//alert("work!")
location.reload(true);
}
Controller
def reQueueTest(int id){
def sql = new Sql(dataSource)
def rowID = id
sql.executeUpdate "update test_exec_queue set [State]='READY' where test_exec_queue_id=$rowID"
sql.close()
}