Bootgrid - Unexpected token < in JSON at position 0

随声附和 提交于 2020-01-22 03:35:51

问题


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:

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)


回答1:


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.



来源:https://stackoverflow.com/questions/52005656/bootgrid-unexpected-token-in-json-at-position-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!