js中用ajax给var showClassDiv={}中data赋值

var showClassDiv=null;
$("#showClassDiv").mySelect_check(showClassDiv);
function queryClassTree(){

$.ajax({
url:"gradeManagerController.do?method=getGradeTree",
type: "POST",
dataType:"json",
success: function (data) {
//var dataObj=eval("("+data+")");
setChildrenTarget(data[0]);
showClassDiv = {
"doChecked": true ,
afterSelect : function (selectData){
$("#mainDiv").show();
conditionQuery(selectData);
$("#showClassDiv").hide();
queryTotal();
$("#deviceNum").html(selectData.length);
},
"data":data[0]
}
}

});
}

/**
*将最底层(班级)的isTarget设为true
*/
function setChildrenTarget(orgData){
if(orgData.children.length==0){
orgData.isTarget="true";
}else{
for(var childData in orgData.children){
setChildrenTarget(orgData.children[childData]);
}
}
}
showClassDiv中data数据的获取
格式:
var showClassDiv= {
"doChecked": true ,
afterSelect : function (selectData){
console.log(selectData) ;
},
"data":{}
}

    推荐阅读