[英]grails remotefunction: can't access params
I've got a remoteFunction call in a javaScript function in my GSP file: 我的GSP文件中的javaScript函数中有一个remoteFunction调用:
function fnCreateEntitiesPerForceChart() {
var interval = $("#entitiesPerForceTimeIntervalSelect").val();
interval = escape(interval);
var url = '${createLink(controller: 'federation', action: 'createEntitiesPerForceChart')}?interval='+interval;
$("#entitiesPerForceChart").attr("src", url);
alert("interval is: " + interval);
${remoteFunction(controller: 'federation',
action: 'getEntitiesPerForceTable',
params: '\'interval\''+':'+interval,
onSuccess: 'fnUpdateEntitiesPerForceTable(data,textStatus)')};
}
When I check the page source, the remotefunction creates this code: 当我检查页面源代码时,远程功能将创建以下代码:
try{DojoGrailsSpinner.show();}catch(e){} dojo.xhr('Get',{content:{'interval':null}, 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){} } });;
Why is my variable being replaced with 'null'? 为什么将我的变量替换为'null'?
Thanks! 谢谢!
试试这个作为remoteFunction
调用中的params
params: '\\'interval\\': + interval'
Try this : 尝试这个 :
function fnCreateEntitiesPerForceChart() {
var interval = dojo.byId("entitiesPerForceTimeIntervalSelect").get("value");
// [...] rest of your code
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.