我有一個data()
對象包含一些json。循環通過jQuery數據()對象獲取鍵和值
有沒有一種方法可以遍歷對象並獲取每個零件的鍵和值?
這是我到目前爲止有:
function getFigures() {
var propertyValue = getUrlVars()["propertyValue"];
$.getJSON(serviceURL + 'calculator.php?value=' + propertyValue, function(data) {
figures = data.figures;
$.each(figures, function(index, figure) {
$('#figureList').append('<li> index = ' + data.figures.figure + '</li>');
});
});
$('#figureList').listview('refresh');
}
JSON的是這樣的:
{"figures":{"value":"150000","completion":"10.00","coal":"32.40","local":"144.00","bacs":"35.00","landRegistry":"200.00","solFee":"395.00","vatOnSolFees":79,"stampDuty":1500,"total":2395.4}}
道歉,如果它的簡單,我是新來的jQuery,但沒有找到任何東西這有幫助。
你期望進去'#figureList'? – VisioN
嘗試此: [http://stackoverflow.com/questions/684672/loop-through-javascript-object][1] [1]:http://stackoverflow.com/問題/ 684672/loop-through-javascript-object –