简体   繁体   English

Grails RemoteFunction创建错误的JavaScript

[英]Grails RemoteFunction creates bad javascript

I am taking over a project from an engineer that left my company, and am having to quickly come up to speed on Grails, so if this is a noob question, well, I'm a noob. 我正在接管一个离开我公司的工程师的项目,并且必须快速跟上Grails的速度,因此,如果这是一个菜鸟问题,那么我就是个菜鸟。

In one of one of my GSP files, I've got a remoteFunction call in the middle of a javaScript function: 在我的一个GSP文件之一中,我在javaScript函数中间有一个remoteFunction调用:

function fnCreateEntitiesPerForceChart() {
      var interval = $("#entitiesPerForceTimeIntervalSelect").val();
      var url = '${createLink(controller: 'federation', action: 'createEntitiesPerForceChart')}?interval='+escape(interval);
      $("#entitiesPerForceChart").attr("src", url);

      ${remoteFunction(controller: 'federation', 
        action: 'getEntitiesPerForceTable', 
        params: '\'interval=\'+interval', 
        onSuccess: 'fnUpdateEntitiesPerForceTable(data,textStatus)')}; 
    }

That remoteFunction call is being sent to the client as: 该remoteFunction调用将以以下方式发送给客户端:

try{DojoGrailsSpinner.show();}catch(e){} dojo.xhr('Get',{content:{'interval='+interval}, preventCache:true, url:'/FederationReporter/federation/getEntitiesPerForceTable', load:function(response){ fnUpdateEntitiesPerForceTable(data,textStatus); }, handle:function(response,ioargs){try{DojoGrailsSpinner.hide();}catch(e){} }, error:function(error,ioargs){try{DojoGrailsSpinner.hide();}catch(e){} } });;

Which is causing a error: SyntaxError: missing : after property id ...){} dojo.xhr('Get',{content:{'interval=' + interval}, preventCache:true, url:'/Fed... 导致错误:SyntaxError:缺少:属性ID之后...){} dojo.xhr('Get',{content:{'interval =' + interval},preventCache:true,url:'/ Fed .. 。

federation (line 400, col 60) (which is the bolded '+' before the second 'interval' 联盟(第400行,第60行)(第二个“间隔”之前的粗体“ +”号

What am I missing? 我想念什么?

Dojo content应为键值对。

{content:{'interval': interval}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM