我正在学习 JavaScript,我需要从 url ( http://example.com?index=goog,dji ) 读取数据,这将返回下面的字符串。现在我想在 html 表中打印名称和值
[
{ "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
我怎样才能使用 JavaScript 和 HTML 做到这一点?