Reputation: 11645
Hi I am trying to invoke a url using JQUery with parameters appended to it. The values of the parameters are from the text fields in the dialog box on the page. When I invoke the url with no values filled in the parameter (i.e url inside if) it execute fine, but when I enter values in the dialog box and run it gives me groovy.lang.MissingMethodException.
I alert the url in both cases and the values are displayed appropriately.
I am also handling the 3 params accordingly in the controller def runUserReport
Here is the code Snippet
function runJasperReport() {
var myurl="";
var from_date=$('#from_date').val();
var to_date=$('#to_date').val();
var user_id=$('#user_id').val();
if(!from_date ||!to_date ||!user_id)
{
myurl='/gra/reports/runUserReport?fromdate=&todate=&userid=';
}
else{
myurl='/gra/reports/runUserReport?fromdate='+from_date+'&todate='+to_date+'&userid='+user_id+'';
}
alert(myurl);
jQuery.ajax({
url: myurl,
dataType: 'html',
timeout: 3000,
beforeSend: function() {
jQuery('#demo').html('<center><div style="width: 70px; height: 100px; display: inline-block;margin-top: 120px;"></div></center>')
},
success:function(data,textStatus){
jQuery('#demo').html(data);
},
error:function(XMLHttpRequest,textStatus,errorThrown){}
});
return false;
Error Received:
groovy.lang.MissingMethodException: No signature of method: gra.ReportsController.$() is applicable for argument types: (gra.ReportsController$_closure8_closure9) values: [gra.ReportsController$_closure8_closure9@22d90078]
Possible solutions: is(java.lang.Object), any(), use([Ljava.lang.Object;), any(g
roovy.lang.Closure), getG(), wait()
Upvotes: 0
Views: 848
Reputation: 120198
Your request to the URL
/gra/reports/runUserReport
is telling grails that there should be a reportsController
with a method runUserReport
on it. However, grails is saying that the url is calling for the method $()
, i.e. so your request looks like
/gra/reports/$()
Something is happening between when you set the url and fire the request. Look in webkit/firebug and the ajax that gets sent and verify that the url is what you think it is.
Upvotes: 2