日期:2014-05-20 浏览次数:20995 次
function doActive(kind,group,state,model,speed,settemp,lock){ this.fkind=kind; this.fgroup=group; this.fstate=state; this.fmodel=model; this.fspeed=speed; this.fsettemp=settemp; this.flock=lock; }
var states=$("#New_fstate").val(); var model=$("#New_fmodel").val(); var speed=$("#New_fspeed").val(); var settemp=$("#New_fsettemp").val(); var lock=$("#New_flock").val(); var myData=new doActive(kindsArray,groupsArray,states,model,speed,settemp,lock); alert($.toJSON(myData)); $.ajax({ type:"post", url:"groupControl.do?operate=doAdd", data:$.toJSON(myData), dataType:"text", contentType:"application/json;charset=UTF-8", error:function(XmlHttpRequest, textStatus, errorThrown){ alert("操作异常" + XmlHttpRequest.responseText); }, success:function(data){ if(data==1){ showMsg("操作完成",4000,"success"); }else{ showMsg("操作异常",4000,"error"); } } });
{"fkind":["张三","李四"],"fgroup":"["王五","赵七"]","fstate":""}
BufferedReader br = new BufferedReader(new InputStreamReader( (ServletInputStream) request.getInputStream())); String line = null; StringBuilder sb = new StringBuilder(); while ((line = br.readLine()) != null) { sb.append(line); } String d=sb.toString(); //d=new String(d.getBytes("GB2312"),"UTF-8"); JSONObject jsonObj = JSONObject.fromObject(d);