前台如何处理后台返回的json数据

后台返回的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);
            }
        });
    }

 

效果图:

 

posted @ 2017-04-12 12:12  流星雨—杰克  阅读(4545)  评论(0编辑  收藏  举报