$.post("Employee_jobquery.action", {
"job.departmentId" : departmentId
}, function(obj) {
var list = eval(obj);//转格式
for (var i = 0; i < list.length; i++) {
var html = "<option value="+list[i].id+">"+list[i].name + "</option>";
$("#job").append(html);//添加下拉项
}
}, "json");
1.根据getDepartmentId获得list_jobs
2.List<Object> list = new ArrayList<Object>();
for (Job j : list_jobs) {
Map<String, Object>temp = new HashMap<String, Object>();
temp.put("id",j.getId());
temp.put("name", j.getName());
list.add(temp);
}
JSONArray json = new JSONArray();
json.addAll(list);
out.print(json.toString());
return null;
联系客服