展开全部
function queryArea() {
return false;
$("#areaId").empty();
$("<option value='-1'>未选区域</option>").appendTo($("#areaId"));
$.ajax({url:"clazz-service.jsp?action=getAreaList",data:$("#infoForm").serialize(),type:"post",
complete:function(text) {
var obj = eval("("+text.responseText+")");
if(obj.flag == "ok") {
//$("#areaId").empty();
var i = 0;
$.each(obj.data, function(index) {
$("<option value='"+obj.data[index].id+"'>"+obj.data[index].name+"</option>").appendTo($("#areaId"));
i++;
});
} else {
//setTimeout(function() {
//}, 2000);
}
}
});
}
JSP
public void getAreaList(HttpServletRequest request, HttpServletResponse response, JspWriter out) throws IOException{
response.setContentType("text/plain; charset=utf-8");
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Map retMap = new HashMap();
int pageIndex = 1;
int pageSize = 8;
try {
String courseId = request.getParameter("courseId");
QueryResult qr=null;//CmsFactory.getAreaManager().getAreaListByCourse(courseId,pageIndex,pageSize);
Map args = new HashMap();
List data = qr.getData();
Map[] dataMap = null;
if(data != null && data.size() > 0) {
dataMap = new Map[data.size()];
for(int i=0; i < data.size(); i++) {
CmsArea area = (CmsArea)data.get(i);
dataMap[i] = new HashMap();
dataMap[i].put("id", area.getId());
dataMap[i].put("name", area.getName());
dataMap[i].put("parentId", area.getParentId());
}
retMap.put("data", dataMap);
retMap.put("flag", "ok");
retMap.put("msg", "查询成功");
}else {
retMap.put("flag", "fail");
retMap.put("msg", "所查询记录不存在");
}
} catch (Exception ex) {
retMap.put("flag", "fail");
retMap.put("msg", ex.getMessage());
}
JSONObject obj = JSONObject.fromObject(retMap);
out.print(obj.toString());
}
return false;
$("#areaId").empty();
$("<option value='-1'>未选区域</option>").appendTo($("#areaId"));
$.ajax({url:"clazz-service.jsp?action=getAreaList",data:$("#infoForm").serialize(),type:"post",
complete:function(text) {
var obj = eval("("+text.responseText+")");
if(obj.flag == "ok") {
//$("#areaId").empty();
var i = 0;
$.each(obj.data, function(index) {
$("<option value='"+obj.data[index].id+"'>"+obj.data[index].name+"</option>").appendTo($("#areaId"));
i++;
});
} else {
//setTimeout(function() {
//}, 2000);
}
}
});
}
JSP
public void getAreaList(HttpServletRequest request, HttpServletResponse response, JspWriter out) throws IOException{
response.setContentType("text/plain; charset=utf-8");
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Map retMap = new HashMap();
int pageIndex = 1;
int pageSize = 8;
try {
String courseId = request.getParameter("courseId");
QueryResult qr=null;//CmsFactory.getAreaManager().getAreaListByCourse(courseId,pageIndex,pageSize);
Map args = new HashMap();
List data = qr.getData();
Map[] dataMap = null;
if(data != null && data.size() > 0) {
dataMap = new Map[data.size()];
for(int i=0; i < data.size(); i++) {
CmsArea area = (CmsArea)data.get(i);
dataMap[i] = new HashMap();
dataMap[i].put("id", area.getId());
dataMap[i].put("name", area.getName());
dataMap[i].put("parentId", area.getParentId());
}
retMap.put("data", dataMap);
retMap.put("flag", "ok");
retMap.put("msg", "查询成功");
}else {
retMap.put("flag", "fail");
retMap.put("msg", "所查询记录不存在");
}
} catch (Exception ex) {
retMap.put("flag", "fail");
retMap.put("msg", ex.getMessage());
}
JSONObject obj = JSONObject.fromObject(retMap);
out.print(obj.toString());
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你把java对象的属相,输出到页面,用div或是span包装一下,这样你想用js 怎么读,就怎么读
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
不知你想实现怎样的功能 从没遇到过你这样的需求..
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询