我的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)')};
}
当我检查页面源时,remotefunction会创建以下代码:
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){} } });;
为什么我的变量被'null'替换?
谢谢!
答案 0 :(得分:0)
在params
来电
remoteFunction
params: '\'interval\': + interval'
答案 1 :(得分:0)
试试这个:
function fnCreateEntitiesPerForceChart() {
var interval = dojo.byId("entitiesPerForceTimeIntervalSelect").get("value");
// [...] rest of your code
}