In a grails view I need to call a javascript method to get some info and so I have a submit action like this:
<input type="submit" name="submit" class="submit action-button" value="Generar" onclick="generateReport()" style="float: right" />
and at the end of the generateReport() I need to call/redirect to the show action of a Controller (because I'm at the create action already)
I'have tried with
1) var jSon = generateJSON();
<g:remoteFunction controller="report" action="show" params="[data:jSon]" />
2) var jSon = generateJSON();
<g:remoteFunction controller="report" action="show" params="[data:${jSon}]" />
1) data reaches null 2) compile error:
org.codehaus.groovy.grails.web.taglib.exceptions.GrailsTagException
Message
Attribute value quote wasn't closed (controller="report" action="show" params="[data:${jSon}]").
remoteFunctionor any of theremote*tags. They are old, difficult to work with, and no longer supported in newer versions of Grails. You need to learn to make your own ajax calls using jquery/javascript.