我在JSON数据中包含此表:
我想做:Res [i] = Code[i] * Code_V[i];
我的脚本是:
get_full_Res = function(obj) {
$.each(obj, function() {
$.each(this, function(k, v) {
console.log("k : "+k+" v: "+v)
});
});
}
在遍历JSON数据后,我不知道如何使用jQuery。请帮助
答案 0 :(得分:0)
Your object is like
var obj = [{
"Name": "X0012",
"Ps": "PO10",
"Code": 31,
"Code_V": 10,
"Res": 0
}, {
"Name": "X0013",
"Ps": "PO11",
"Code": 22,
"Code_V": 11,
"Res": 0
}, {
"Name": "X0014",
"Ps": "PO12",
"Code": 1,
"Code_V": 12,
"Res": 0
}];
then we can use for loop here
for(var k in obj)
{
console.log(obj[k].Code * obj[k].Code_V);
}