English 中文(简体)
未适当运作的变数范围
原标题:Javascript scope of variables not working properly

我是一位业余方案家,时间很紧,几乎没有项目。 我愿从谷歌电子表格中获取数据,修改数据,并绘制谷歌图(使用 go图)。

下述法典完全在欧恩德,但 Chrome和伊埃特公司不允许在操作的QueryResponse(e)功能范围之外提供数据。 我的第一个想法是,从处理过的QueryResponse(e)功能中收回数据,但这一功能(send(e))。

任何帮助都将受到高度赞赏。

function getDataTable(link) {
     var dataTable= new google.visualization.DataTable();
     var queryTrip = new google.visualization.Query(link);
     queryTrip.send(handleQueryResponse);
     function handleQueryResponse(response) {

         if (response.isError()) {

             alert( Error in query:   + response.getMessage() +     + response.getDetailedMessage());
             return;
         }

         dataTable = response.getDataTable();
         // I can verify this has the data through debugging in Chrome  
     }
     // Outside of the function handleQueryResponse the dataTable is gone
    return dataTable;
 }
问题回答

称为“同步功能”的功能(queryTrip.send)cannot 回归数据,取决于该同步功能要求的结果,也不使用数据。

这一数据可在反馈功能中查阅 >,随后称为by<>。

正如费利克斯提到的那样,这很可能是不合时宜的,这意味着,随着处理QueryResponse的到来,变数不再存在,因为它不能立即在职能范围内运作。

你们可以将数据变数摆在桌面上。 超出这一范围(全球范围)的表,可与处理质量问题表相加。

然而,你将要求启动任何需要履行的职能,这些职能是在可调用数据后从可操作的QueryResponse功能中准备好的。 最好的行动方针可能是,在数据表准备好后,使用某种由活动驱动的处理方法。





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.