我刚刚开始这样做,所以我对如何使用以下内容感到困惑。
// so I believe this really isn't an object just a string representation, but for example please excuse the name
var dataObj = "{'id': 1,
'data': { 'color': 'red',
'shape' : 'triangle',
'height' : 100,
'width' : 45,
},
'id': 2,
'data': { 'color': 'blue',
'shape' : 'square',
'height' : 75,
'width' : 67,
},
'id': 3,
'data': { 'color': 'orange',
'shape' : 'circle',
'height' : 89,
'width' :24,
}
}";
所以我遇到的问题是如何通过 id 更新数据值的特定子集(比如 SQL UPDATE WHERE 之类的东西)?javascript 或 jquery 对我来说真的无关紧要,只是不知道任何一种方法。
dataObjUpdate(2);
function dataObjUpdate (passedID) {
//access the data by the passedID match and update the color to black
}
感谢帮助家伙....