jqGrid的一个错误 parsererror错误

来源:互联网 发布:好老师淘宝店视频教学 编辑:程序博客网 时间:2024/05/16 06:25

在写jqgrid时出现如下错误

 

loadError: function (xhr, st, err) {
alert("Type: " + st + "; Response: " + xhr.status + " " + xhr.statusText); 
}, //处理服务器端的
错误原因:
1、在后台的ashx页面中没有给header指定编码
  public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "UTF-8";
2、返回的json对象的格式不正确
1.4(jquery)对json对象的字符串严格要求字符串(中的变量要用""引起来)
在我的生成json对象的语句 中
 
字段id后面的值 没有用""引起来,所以报此错误信息
解决方法:
json错误语句更改为
 jsonBuilder.Append("{/"id/":/"" + dt.Rows[i][0].ToString() + "/",/"cell/":[");
原创粉丝点击