问题
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 .
解决方法
Yes, from onward 2.4.x g:remoteFunction has been deprecated in grails.
Though, you can always use the javascript/jQuery ajax function as below which is exactly does the same thing.
function callMyAjax(){
$.ajax({
url:'${g.createLink( controller:'yourcontroller', action:'youraction')}',
data:{
param1:param1,
param2:param2
}
});
}
随着 Rails 从 2.4.7 升级到 3,g:remoteFunction 和 formRemote 标签已不再可用。博主分享了如何使用 jQuery 的 AJAX 函数来替代这些旧的标签,以实现相同的功能。通过示例代码展示了如何定义一个名为 callMyAjax 的函数,利用 $.ajax 进行控制器和动作的调用,传递参数的方式也进行了说明。


被折叠的 条评论
为什么被折叠?



