我正在學習JavaScript,並且需要從URL(http://example.com?index=goog,dji)讀取數據,該數據將返回下面的字符串。現在我想打印的名稱和價值,我怎麼能這樣做使用JavaScript和HTML的HTML表格解析JSON數據並打印它
[
{ "id": "983582" ,"t" : ".DJI" ,"e" : "INDEXDJX" ,"l" : "15,081.47" ,"l_cur" : "15,081.47" ,"s": "0" ,"ltt":"4:35PM EDT" ,"lt" : "Aug 16, 4:35PM EDT" ,"c" : "-30.72" ,"cp" : "-0.20" ,"ccol" : "chr" },
{ "id": "694653" ,"t" : "GOOG" ,"e" : "NASDAQ" ,"l" : "856.91" ,"l_cur" : "856.91" ,"s": "0" ,"ltt":"4:00PM EDT" ,"lt" : "Aug 16, 4:00PM EDT" ,"c" : "-2.75" ,"cp" : "-0.32" ,"ccol" : "chr" }
]
輸出
INDEXDJX - 15,081.47
GOOG - 856.91
?
請發佈您迄今爲止所嘗試的內容。你可以[在MDN上學習Ajax](https://developer.mozilla.org/en-US/docs/AJAX/Getting_Started),如何解析JSON就可以解答[here](http://stackoverflow.com/q/4935632/218196)以及如何處理數組/對象的答案[這裏](http://stackoverflow.com/questions/11922383/access-process-nested-objects-arrays-or-json)。 –