0

我的 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)')}; 
    }

当我检查页面源时,远程函数会创建以下代码:

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”?

谢谢!

4

2 回答 2

0

尝试这个 :

function fnCreateEntitiesPerForceChart() {
  var interval = dojo.byId("entitiesPerForceTimeIntervalSelect").get("value");
  // [...] rest of your code
}
于 2013-04-29T15:16:18.510 回答
0

paramsremoteFunction通话中试试这个

params: '\'interval\': + interval'

于 2013-04-25T19:44:55.233 回答