跨域jqgrid数据未显示

时间:2014-04-17 14:40:25

标签: jquery jqgrid

我的程序有问题,因为我想从我的网站访问数据。 数据由REST服务器发布。 我确实得到了数据,但没有显示出来。以下是JSON数据的示例:

  

{ “数据”:[{ “UID”:1, “年龄”:30, “cedula”:54689, “姓氏”: “库马尔”, “邮件”: “ALGO @ ailfs”, “姓名”: “萨姆”},{ “UID”:2, “年龄”:35, “cedula”:123589, “姓氏”: “库玛”, “邮件”: “lndsfkl @ kjnnf”, “名”: “拉姆”} { “UID”:3, “时代”:39, “cedula”:8453, “姓氏”: “佩雷斯”, “邮件”: “sdbfk @ kgmial”, “名”: “萨姆”},{“UID “4,” 时代 “:56,” cedula “:87956216,” 姓氏 “:” 佩雷斯”, “邮件”: “kav@gamil.com”, “名”: “佩佩”},{ “UID”: 5, “年龄”:72, “cedula”:849666, “姓氏”: “穆希卡”, “邮件”: “pepe@gmail.com”, “名称”: “佩佩”},{ “UID”:6, “时代”:25, “cedula”:10565896, “姓氏”: “Aughburn”, “邮件”: “截拳道@ gmail的”, “名”: “犹太”}], “页”:1, “每页”: 6, “总页数”:2}

和我的jqgrid代码:

jQuery("#jQGridDemo").jqGrid({
    url: myurl, 
    datatype: "jsonp",
    mtype: "GET",
    ajaxGridOptions: { contentType: 'application/json; charset=utf-8' }, 
    jsonReader: {
        root: "Data",
        page: "Page",
        total: "TotalPages",
        records: "PageSize",
        repeatitems: true,
        cell: "",
        id: "0"
    },
    colNames: ['Id', 'Nombre', 'Apellido', 'Edad', 'Cedula',
             'Email'],
    colModel: [
    { name: 'Uid', index: 'Uid', width: 20 },
    { name: 'name', index: 'name', width: 150 },
    { name: 'lastName', index: 'lastName', width: 150 },
    { name: 'age', index: 'age', width: 120 },
    { name: 'cedula', index: 'cedula', width: 60 },
    { name: 'mail', index: 'mail', width: 200, sortable: false },
    ],
    rowNum: 5,
    rowList: [2, 5, 10],
    sortname: 'Id',
    loadonce: true,
    viewrecords: true,
    ignoreCase: true,
    sortorder: "desc",
    caption: "Usuarios del Sistema",
    loadError: function (xHr, status, error) { alert(error);}
}); 

我把loadError函数放入其中,它表示如“错误:jQuery111045 ......未被调用”

Thanx寻求帮助。

0 个答案:

没有答案