0
JSON數據,這是我的JSON格式無法檢索從給定的格式
({"message":{"success":true,"result":[{"lead_no":"LEA13","lastname":"Developer","firstname":"PHP","company":"Dummies","email":"[email protected]","id":"10x132"},{"lead_no":"LEA14","lastname":"Venu","firstname":"Yatagiri","company":"Rsalesarm","email":"[email protected]","id":"10x133"},{"lead_no":"LEA4","lastname":"Jones","firstname":"Barbara","company":"Vtigercrm inc","email":"[email protected]","id":"10x35"},{"lead_no":"LEA1","lastname":"Smith","firstname":"Mary","company":"Vtiger","email":"[email protected]","id":"10x32"}]}})
我將嘗試使用下面的代碼片段中檢索到整個JSON結果值
if (xmlHttp.readyState==4)
{
alert(xmlHttp.status);
if(xmlHttp.status==200)
{
alert("hi");
var jsondata=eval("("+xmlHttp.responseText+")") //retrieve result as an JavaScript object
jsonOutput=jsondata.result;
alert(jsonOutput);
InitializeLeadStorage()
}
}
我alert (hi)
顯示,但alert(jsonOutput);
是不確定的,請幫助我,如果你能發現任何錯誤
jsonOutput = jsondata.message.result; 我用過這個,但仍然困擾着我,我沒有找到任何改變 – kavinhuh 2012-07-11 11:35:18
你是什麼意思改變? 'jsondata.message.result'是否保持你期望的值? – Utkanos 2012-07-11 11:36:45
實際上它擁有一個數組,我通過alert(jsonOutput)檢查了它;使用此警報,它顯示未定義的 – kavinhuh 2012-07-11 11:37:36