2011-02-11 85 views
0
function getSsrBandAid(ssn,id) {  
    DWREngine._execute(_ajaxConfig._cfscriptLocation, null, 'getSsrBandAid', ssn, doQueryResults); //calling method in decRequest.cfc  
    function doQueryResults(t){ 
    xmlT = loadXMLString(t); 
    alert(ssn);    
    } 
} 

試圖通過爲ssn到doQueryResults()函數。
我試過這個doQueryResults(t,ssn),但它不起作用。傳遞變量到內功能

任何幫助表示讚賞。

謝謝

+0

是否有錯誤?因爲乍一看代碼看起來很好。也許它是由_execute函數的DWREngine對象決定的? – Olical 2011-02-11 13:20:41

+0

我收到「未定義」錯誤。有沒有其他方法可以傳遞它?謝謝 – Noe 2011-02-11 13:38:19

回答

1

ECMA-/Javascript有一個靜態(詞法)範圍。它還具有「innerContext」關閉「outerContext」的功能。

要長話短說,您的doQueryResults()將複製父範圍(即getSsBBandAid)。這包括保存參數的激活對象

因此,如果alert(ssn);未定義,則在調用getSsrBandAid()時也不確定。