62,041
社区成员
发帖
与我相关
我的任务
分享
$.ajax({
url: "xxx.ashx",
dataType: "json",
//data: "type=getRoleList",
type: "GET",
error: function() { },
beforeSend: function() { $("#lbltest").html("正在加载,请稍后..."); },
success: function(data) {
if (data.options.length == 0) {
alert("禁止操作!");
document.getElementById("btnSave").disabled = "disabled";
}
else{
$.each(data.options, function(index, value) {
var option = new Option(value.text, value.value);
document.getElementById("lstRole").add(option);
});
}
}
}); <select id="lstRole" style="width:150px"></select>
var people =
{ "authors": [
{ "firstName": "Isaac", "lastName": "Asimov", "genre": "science fiction" },
{ "firstName": "Tad", "lastName": "Williams", "genre": "fantasy" },
{ "firstName": "Frank", "lastName": "Peretti", "genre": "christian fiction" }
]
}
//取值:
people.authors[1].genre 值为 fantasy
自己按照此方式推一下就知道了