I worked in grails 2.4.7 .Recently i shifted to grails 3.Previously i used grails custom tag for ajax call like remoteFunction, formRemote .This tags are not available for recent version.Can any one tell me the best way of using ajax for recent version .
Asked
Active
Viewed 1,499 times
2
-
Are you migrating code from 2.4.7 to 3 or starting a new project? – Mike W Jun 05 '17 at 07:05
-
No .New project for grails 3 . – Sayem Jun 05 '17 at 07:06
-
2You can pull the old Grails ajax tag plugin behavior over with `compile 'org.grails.plugins:ajax-tags:1.0.0'` which i'd advise if migrating but if you're starting from scratch I'd implement yourself, is there a specific problem you're trying to solve or just generic question? – Mike W Jun 05 '17 at 07:10
2 Answers
5
Yes, from onward 2.4.x g:remoteFunction
has been deprecated in grails.
See this. http://docs.grails.org/2.4.1/ref/Tags/remoteFunction.html
Though, you can always use the javascript/jQuery ajax function as below which is exactly does the same thing.
<g:javascript>
function callMyAjax(){
$.ajax({
url:'${g.createLink( controller:'yourcontroller', action:'youraction')}',
data:{
param1:param1,
param2:param2
}
});
}
</g:javascript>
<input type="button" onclick="callMyAjax()"/>

Parth Soni
- 11,158
- 4
- 32
- 54
0
As I could see, ajax-tags
has been deprecated due to inefficiency issues. They recomend to use Ajax or native javascript.
Any way, if you still need them, there is a plugin for grails 3 provided as a migration library, but you can use it aswell:
compile 'org.grails.plugins:ajax-tags:1.0.0.RC1'

IgniteCoders
- 4,834
- 3
- 44
- 62