Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
grailsg:remoteLink响应_Grails - Fatal编程技术网

grailsg:remoteLink响应

grailsg:remoteLink响应,grails,Grails,如何使用jquery从使用g:remoteLink进行的ajax调用中获得响应 我尝试过使用nsaccess=“removeTask(e)”并使用e.responseText或e.response获取响应,但没有任何效果。在JQuery插件中使用Grails并使用remoteLink等远程函数时,为远程函数生成的代码如下所示: success: function(data, textStatus){ jQuery('#results').html(data); } <g:remoteLi

如何使用jquery从使用g:remoteLink进行的ajax调用中获得响应


我尝试过使用
nsaccess=“removeTask(e)”
并使用e.responseText或e.response获取响应,但没有任何效果。

在JQuery插件中使用Grails并使用remoteLink等远程函数时,为远程函数生成的代码如下所示:

success: function(data, textStatus){ jQuery('#results').html(data); }
<g:remoteLink controller="yourcontroller" action="youraction" update="[success: 'results']" onSuccess="yourFunction(data) ">Your link</g:remoteLink>
success:function(data,textStatus){ jQuery('#results').html(data); yourFunction(data); }
例如,如果将更新参数设置为“[success:'results']”,则会出现这种情况。正如您所看到的,main函数接收一个数据参数,我认为这是您要查找的,因此,如果您需要调用另一个使用该值的函数,您可以执行以下操作:

success: function(data, textStatus){ jQuery('#results').html(data); }
<g:remoteLink controller="yourcontroller" action="youraction" update="[success: 'results']" onSuccess="yourFunction(data) ">Your link</g:remoteLink>
success:function(data,textStatus){ jQuery('#results').html(data); yourFunction(data); }
希望这有帮助