次の文字列を取得します。
[{"Key":1,"Value":"correct"},{"Key":2,"Value":"incorrect"},{"Key":3,"Value":"incorrect"},{"Key":4,"Value":"correct"},{"Key":5,"Value":"incorrect"}]
JSON で TR の ID の値が「正しい」か「正しくない」かに基づいて、TR の背景色を変更したいと考えています。
JSON から個々のアイテムの値を取得するにはどうすればよいですか? 私が試してみました:
success: function (result) {
// update with results
//alert(JSON.stringify(result));
//$('#myDiv').html(JSON.stringify(result));
// non of these work
alert(result[0]);
alert(result[key]);
},