When I tried to set a variable from javascript function in GSP view I had error: "Cannot invoke method func() on null object"
GSP:
<g:set var="variable" value="${tr.func.name()}" />
I also tried to the get around the problem without success: variable is undifined
<g:javascript>var test = tr.func.name();</g:javascript>
<g:set var="variable" value="${test}" />
<g:javascript>alert(${variable});</g:javascript>
Thanks