前端
var mydata={
environmentnameselect:$("#environmentname").val()
,systermnameselect:$("#systermname").val()
,jsonobj:JSON.parse($("#jsonstr").val())
};
$.ajax({
type :"POST"
,url: '/sysconfig_save_jsonstr'
,data: JSON.stringify(mydata)
,dataType: 'text'
,success: function (data) {
alert(data);
}
});
后端
@app.route('/sysconfig_save_jsonstr', methods=['GET','POST'])
@wrapper
def sysconfig_save_jsonstr():
try:
data = request.get_data()
data = json.loads(data)
environmentname = data['environmentnameselect']
systermname = data['systermnameselect']
json_value =data['jsonobj']
return "success"
except Exception as e:
return "error"