想实现这个效果::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);
这样写不对。应该怎么改
侃侃无极
相关分类