怎么用jquery把这个json对象传到后台保存到数据库,最好前台后台都提供一点代码,谢谢
jsondata={title:"aaa",nodes:{node_1:{name:"node_1",left:67,top:69,type:"start",width:...
jsondata={
title:"aaa",
nodes:{
node_1:{name:"node_1",left:67,top:69,type:"start",width:24,height:24},
node_2:{name:"node_2",left:219,top:71,type:"task",width:86,height:24},
node_5:{name:"node_5",left:380,top:71,type:"fork",width:86,height:24},
node_16:{name:"node_16",left:500,top:71,type:"end",width:86,height:24}
},
lines:{
demo_line_3:{type:"sl",from:"node_1",to:"node_2",name:"",marked:false},
demo_line_6:{type:"sl",from:"node_2",to:"node_5",name:"",marked:false},
demo_line_17:{type:"sl",from:"node_5",to:"node_16",name:"",marked:false}
},
areas:{
demo_area_8: {name:"area_8",left:35,top:39,color:"red",width:472,height:114}
}
};
springMVC 展开
title:"aaa",
nodes:{
node_1:{name:"node_1",left:67,top:69,type:"start",width:24,height:24},
node_2:{name:"node_2",left:219,top:71,type:"task",width:86,height:24},
node_5:{name:"node_5",left:380,top:71,type:"fork",width:86,height:24},
node_16:{name:"node_16",left:500,top:71,type:"end",width:86,height:24}
},
lines:{
demo_line_3:{type:"sl",from:"node_1",to:"node_2",name:"",marked:false},
demo_line_6:{type:"sl",from:"node_2",to:"node_5",name:"",marked:false},
demo_line_17:{type:"sl",from:"node_5",to:"node_16",name:"",marked:false}
},
areas:{
demo_area_8: {name:"area_8",left:35,top:39,color:"red",width:472,height:114}
}
};
springMVC 展开
1个回答
展开全部
前台用异步或同步提交方法
$.ajax({
//要用post方式
type: "Post",
//方法所在页面和方法名
url:,
data:,
contentType: "application/json",
dataType: "json",
success: function (data) {
if (data.d) {
}
},
error: function (err) {
}
});
后台用[WebMethod] 静态方法去作处理,至于怎么解析JSON,怎么保存到数据库,LZ应该都会的吧。
$.ajax({
//要用post方式
type: "Post",
//方法所在页面和方法名
url:,
data:,
contentType: "application/json",
dataType: "json",
success: function (data) {
if (data.d) {
}
},
error: function (err) {
}
});
后台用[WebMethod] 静态方法去作处理,至于怎么解析JSON,怎么保存到数据库,LZ应该都会的吧。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询