English 中文(简体)
A. 从功能中返回阿雷拉的路标
原标题:Trouble with Javascript namespacing in returning an Array from a function

我呼吁分享点(见下文)。

function GetProductIDSforActiveQuote() {
var arr = new Array();
$().SPServices({
    operation: "UpdateListItems",
    listName: "Quotes",
    ID:quoteID,
    completefunc: function (xData, Status) {
      $(xData.responseXML).SPFilterNode("z:row").each(function() {
        arr = $(this).attr("ows_Products").split( , );
      });
    }
  });
return arr;
}

我试图返回阿雷拉,但最终却有一个空阵。 我可以通过把ole木放在完整f块内来核实,这些数值正在适当退还。

最佳回答

阿马齐格世界大会的呼吁是同步的。 这意味着,到你打上<条码>时,<条码>即<>。 一定会援引吨位。

各位能否修改该守则,以便它能发挥提供阵列的后备功能? 与此类似:

function GetProductIDSforActiveQuote(callback) {
    // other details omitted
    completefunc: function (xData, Status) {          
        arr = // your code
        callback(arr); // <- here s the difference.
      };        
}    

在警示职能中,你可以处理你所需要的阵列。

问题回答

看像<条码>SPservices是不合时宜的,因此在回复到达之前将返回。 您必须使用<代码>completefunc内的阵列。





相关问题
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.

热门标签