JQuery getJSON - ajax parseerror

后端 未结 17 1879
南笙
南笙 2020-12-01 13:04

I\'ve tried to parse the following json response with both the JQuery getJSON and ajax:

[{\"iId\":\"1\",\"heading\":\"Management Services\",\"body\":\"

17条回答
  •  不思量自难忘°
    2020-12-01 13:27

    It is maybe because your output buffer is not empty, so AJAX receive bytes which don't belong to the JSON.

    Try clean buffer with ob_clean() on server side just before output your json with echo or die(). And you don't need to specify contentType, I think for you default value will work correctly.

    I had the same problem and it solve it.

    Hope to help you.

提交回复
热议问题