我有一个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 –