Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Since g:remoteFunction in Grails 2.4.X is deprecated what should i use instead?

Tags:

grails

Since g:remoteFunction is deprecated what should I use instead? And please give an example.

like image 894
Asim Poptani Avatar asked Oct 01 '22 02:10

Asim Poptani


1 Answers

you should use your own javascript AJAX functions, as they provide way more flexibility

EXAMPLE

used to be:

<input type="button" value="go!" onclick="${g.remoteFunction( controller:'my', action:'go', params:[..] )}"/>

should be (for example in JQuery):

<g:javascript>
  function go(){
    $.ajax({ 
      url:'${g.createLink( controller:'my', action:'go', params:[..] )}',
      data:{ param1:param1 }
    });
  }
 </g:javascript>

 <input type="button" value="go!" onclick="go()"/>
like image 196
injecteer Avatar answered Dec 31 '22 20:12

injecteer