从数组中获取JSON对象Value



我无法获取html id输入字段的对象值。

JSON返回

// response from the call
{
"COLUMNS": ["cityname", "stateabbr"],
"DATA": [
["Culver City", "CA"]
]
}
$.each(response, function(index, zc) {
$("#cityname").append([zc[0]]);
$("#stateabbr").append([zc[0]]);
});

您必须为每个问题进行修复。试试这个

$("#cityname").val(response.DATA[0][0]);
$("#stateabbr").val(response.DATA[0][1]);

最新更新