2013-05-22 43 views
0

燒成查詢之後收到我在我的DOM結構,它看起來像JSON解析對象阿賈克斯

window>object>payload>records>0>Object { attributes={...}, Id="a0E90K", Name="David", more...} 
    ..............................2>Object { attributes={...}, Id="a0E90K", Name="alen", more...} 
    ..............................3>Object { attributes={...}, Id="a0E43K", Name="woody", more...} 
    ..............................4>Object { attributes={...}, Id="a2341K", Name="mac", more...} 
    ..............................5>Object { attributes={...}, Id="a344R7K", Name="fin", more...} 

這哪裏是有效載荷的發射結果與ajax.Now查詢後,我得到了我如何獲取記錄的ID和名稱?

+0

您可以發佈您的數據結構更清晰格式,它幾乎是不可讀的。另外,項目#1在哪裏? –

+0

你得到的是什麼正確的JSON格式? –

+0

OMG這是什麼? (巫術!)請發佈正確的格式或至少一部分代碼。 – DaGLiMiOuX

回答

0

我假設從服務器的JSON結果是一樣的東西

{"records"=[{"attributes"={[..]}, id="aoEdds", Name="David"},{Rec2Info, etc}]}

針對上述JSON,您可以解析ajax success callback像下面

success:function(data){ 
    $.each(data.records,function(i){ 
    alert($(this).id); // gives id 
    alert($(this).Name); 
    }); 
    }