1. 定义对象
//定义全局对象
var classifyObj=new Object();
//调用请求
getClassify();
function getClassify() {
$.ajax({
url : "/common/secFile/classifyList",
type : "get",
async : false,
success : function(data) {
classifyObj=data;
},
});
}
//使用对象,变为下拉框的选项
function setClassifyOption(){
for (var i = 0; i < classifyObj.rows.length; i++) {
var option = document.createElement("option");
$(option).val(classifyObj.rows[i].id);
$(option).text(classifyObj.rows[i].name);
$('#classify').append(option);
}
}