ajax读取返回的json格式的数据
**
//alert(msg);//{"serverHost":"23","mail":"32","mailPassword":"23"} //json = eval(json); //alert("===json:id=" + json.id + ",uname=" + json.uname + ",email=" + json.email); ajaxobj=eval("("+msg+")"); $("#serverHost").val(ajaxobj.serverHost); $("#mail").val(ajaxobj.mail); $("#mailPassword").val(ajaxobj.mailPassword);
**
$.ajax({ async : false, cache : false, type : \'post\', dataType : "json", url : "<%=path%>/process/process!getFileByTypeId.action?model.busiTypeId="+typeId+"&date="+new Date(), success : function(msg) { if(msg){ for(var i=0;i<msg.length;i++){ $("#fileId").append("<option value=\'"+msg[i].id+"\'>"+msg[i].name+"</option>"); } } } });
**
$.ajax({ async : false, cache : false, type : \'post\', dataType: "json", data: { "model.dq": dq}, url : \'<%=path%>/khgl/jcxx/khxx/khxx!getQy.action?\'+new Date(), success : function(json) { var objs = eval(json); $(objs).each(function(index) { var obj = objs[index]; var opt = new Option(obj.name,obj.id); cs.options.add(opt); }); } });
**
List<TZdKhqy> qyList = qyService.getInfoForList(hql.toString(), params); if (qyList != null && qyList.size() > 0) { for (TZdKhqy qy : qyList) { jsonObject = new JSONObject(); jsonObject.put("id", qy.getMc()); jsonObject.put("name", qy.getMc()); jsonArray.add(jsonObject); } } return this.renderText(jsonArray.toString());
**
版权声明:本文为qingmaple原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。