Bootgrid-意外令牌<在JSON中的位置0 [英] Bootgrid - Unexpected token < in JSON at position 0

查看:107
本文介绍了Bootgrid-意外令牌<在JSON中的位置0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用ajax填充的bootgrid表,问题是当我从db中选择多列时,在十列之后我收到一个错误.有谁知道boodgrid是否有限制或其他限制.我指定数据是可以的,我用少于11行的数据对所有数据进行了测试,并且效果很好,但是如果我从db中选择了10列以上,则会收到以下信息:

I am having a bootgrid table which I populate using ajax, the problem is when I select multiple columns from db, after ten columns I receive an error. Does anyone know if boodgrid has a limitation or something. I specify that the data are ok, I tested all of them with less than eleven rows and it works perfectly, but if I select more than 10 columns from db I receive this:

未捕获到的SyntaxError:意外令牌<在JSON的JSON.parse()位置0处
at Function.m.parseJSON(VM217 jquery-1.11.3.js:5)
在Object.success上(VM219 jquery.bootgrid.js:231)
在j时(VM217 jquery-1.11.3.js:2)
at Object.fireWith [as resolveWith](VM217 jquery-1.11.3.js:2)
在x处(VM217 jquery-1.11.3.js:5)
在XMLHttpRequest.b(VM217 jquery-1.11.3.js:5)

Uncaught SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse ()
at Function.m.parseJSON (VM217 jquery-1.11.3.js:5)
at Object.success (VM219 jquery.bootgrid.js:231)
at j (VM217 jquery-1.11.3.js:2)
at Object.fireWith [as resolveWith] (VM217 jquery-1.11.3.js:2)
at x (VM217 jquery-1.11.3.js:5)
at XMLHttpRequest.b (VM217 jquery-1.11.3.js:5)

推荐答案

您的请求不会返回JSON,但是(很有可能)HTML和HTML以<!DOCTYPE<html>开头,或者以您意外的<开头.它尝试将HTML解析为JSON字符串,不能解析,并且报错.

Your request doesnt return JSON, but (highly likely) HTML and the HTML starts with <!DOCTYPE or <html>, either starts with your unexpected <. It tries to parse the HTML as a JSON-string, can't, and errors.

如果打开浏览器控制台,请转到标签,在其中可以查看发出的请求(例如网络"),选择出现错误的请求,然后查看实际返回的内容.那里会有错误或其他信息,将您推向正确的方向.

If you open your browsers console, go to the tab where you can see the requests made (e.g.'Network'), select the one with the error and see what you actually get returned. There will be an error there or other information to push you in the right direction.

这篇关于Bootgrid-意外令牌&lt;在JSON中的位置0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆