java
String id =request.getParameter("id");
PrintWriter out =response.getWriter();
JcvvvxxBean jzwxxBean= ContDao.getGyfContrctInfo(id);
JSONArray json = JSONArray.fromObject(jzwxxBean);
out.print(json);//返给ajax请求
out.close();
js:
$(document).ready(function(){ $('#select1').change(function(){ $.ajax( { url : "./getInfo.do", type : "GET", async : false, data : "id="+$('#select1').val(), // dataType : 'json', contentType : "application/x-www-form-urlencoded;charset=utf-8", success : function(data, textStatus) { var datal =eval(data); //之后做处理 } }); }
转载于:https://blog.51cto.com/qihoushangshu/1437094