{"22222":"DL00019","123":"DL00028","321":"DL00029","111111111":"DL00017","测试道路2":"DL00018"}这种json格式的我要怎么取值啊 来对应select标签的value和text
就是要取到 ”测试道路2“ “DL00018”这种,给一个option赋值$.post("BindRoad.ashx", { 'areaCode': areaCode}, function(data) { var arr = eval(data); var ddlRoad = document.getElementById('<%=ddlRoadcode1.ClientID %>'); ddlRoad.options.length = 0; }, "json");求解
6 回答
慕姐4208626
TA贡献1852条经验 获得超7个赞
var str ="{\"22222\":\"DL00019\",\"123\":\"DL00028\",\"321\":\"DL00029\",\"111111111\":\"DL00017\",\"测试道路2\":\"DL00018\"}"; var json = eval('('+str+')') alert(json["321"]); alert(json["111111111"]);
慕丝7291255
TA贡献1859条经验 获得超6个赞
var obj = { "22222": "DL00019", "123": "DL00028", "321": "DL00029", "111111111": "DL00017", "测试道路2": "DL00018" };
for (var key in obj) {
alert(key);
alert(obj[key]);
}
添加回答
举报
0/150
提交
取消