想实现这个效果::http://www.helloweba.com/demo...前台的ajax:function getdata(){ var num = $("#cur_num").val(); $.ajax({ url: 'updateCountWx.action', type: 'POST', dataType: "json", data:{'total':num}, cache: false, timeout: 10000, error: function(){}, success: function(data){ show_num(jsonb.counttest); } });}我现在不明白。后台应该怎么写才能和这个前台的ajax对应起来。 JSONArray jsonas=new JSONArray(); JSONObject jsonb=new JSONObject();ps=conn.prepareStatement("select count(*) count from text"); resl=ps.executeQuery();//返回查询的数量。 if(resl.next()){ counttest=resl.getInt("count"); jsonb.put("counttest", counttest); }out.print(jsonb);这样写不对。应该怎么改
2 回答

侃侃无极
TA贡献2051条经验 获得超10个赞
out 中设置content-type为application/json
show_num(jsonb.counttest) 改为show_num(data.counttest)
添加回答
举报
0/150
提交
取消