0
我接手一个项目,从离开我公司的工程师,我不得不赶紧拿出来加速对Grails的,因此,如果这是一个小白的问题,好吧,我是小白。Grails的RemoteFunction产生坏的JavaScript
在我的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)')};
}
这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){} } });;
这是造成一个错误: 语法错误:丢失:后物业编号 ...){} dojo.xhr( '获取',{内容:{ '间隔=' +间隔},preventCache:真实,网址:'/ Fed ...
联合会(线400,列60)(其在第二个 '间隔'
我缺少前粗体 '+'?
好吧,但我怎么改变remotefunction呼叫,从而产生更好的道场线? – JeffW 2013-04-24 14:29:04
将我的params行更改为params:'\'interval \''+':'+ interval,它给了我一个有效的内容对。谢谢! – JeffW 2013-04-24 14:40:18
这次问题确实在你的代码上。如果您想更改remoteFunction调用或grails dojo插件提供的任何内容,则必须在https://github.com/cfxram/grails-dojo中分发项目,然后使用您的分支。 – Philippe 2013-04-24 15:28:39