我在加载 jqGrid 时出现如下错误:
加载错误:错误:无效的 XML:{"d":[{"id":1,"name":"Medical 1","city":"Kiev","instituteTypeId":0},{"id": 2,"name":"医疗 2","city":"Kherson","instituteTypeId":0}]}
但是我使用 JSON,oleg 建议我打开新的威胁。
jQuery代码是:
mtype: 'POST',
contentType: "application/json",
url: "dataServices/objects.asmx/InvokeData",
ajaxGridOptions: {
contentType: 'application/json; charset=utf-8'
},
postData: JSON.stringify({q: "med&1"}),
loadonce: true,
dataType: 'json',
jsonReader: {
root: function (obj) {
alert(obj.d);
return obj.d;
},
page: "",
total: "",
records: function (obj) {
return obj.d.length;
},
},
gridview: true,
loadError: function (xhr, status, error) {
alert('load error: ' + error);
},
没有 dataType= xml 或任何定义....