后台返回的json数据格式:
{
"state": true,
"data": {
"id": 0,
"name": "testAjax"‘"sex": null,
"csny": null,
"mz": null,
"byxx": null,
"sfzh": null,
"yhtc": null,
"hjszd": null,
"jtzz": null,
"jtlxdh": null,
"fqxm": null,
"fqgzdw": null,
"fqlxdh": null,
"mqxm": null,
"mqgzdw": null,
"mqlxdh": null,
"szjxbgdpj": null,
"qmszcp": null,
"zhszpjjg": null,
"bz": null,
"bzy": null,
"bze": null,
"xjh": null,
"img": null,
"mm": null,
"remm": null,
"timeStamp": 0,
"wordFilePath": null
},
"msg": "success"
}
前台发的ajax请求:
function tj() {
$.ajax({
type : "POST",
url : "fdzx/ajaxData",
data: "name=John&location=Boston",
success : function(data) {
alert("Data Saved: state:" + data.state+",name:"+data.data.name+",msg:"+data.msg);
}
});
}
效果图:
原创文章如转载,请注明出处“
伊人博客”