JSON response format error - red dot\bullet before response

后端 未结 5 1946
南笙
南笙 2020-11-30 09:29

I am sending an AJAX request expecting JSON response. However, the returned JSON is preceded with a red dot\\bullet which is causing a parse error.

Here is a screens

相关标签:
5条回答
  • 2020-11-30 09:39

    I was faced red dots problem in my ajax response I tried a lot of solution but doest work for me after then I tried ob_clean() function I got the solution I solved my problem using ob_clean() inside the constructor method

    function __construct()
    {
        ob_clean();
    }
    
    0 讨论(0)
  • 2020-11-30 09:40

    As mentioned in a comment before: In Chrome, red dots usually represent non-printable special unicode characters.

    Please check your server side code to prevent outputting those characters

    0 讨论(0)
  • 2020-11-30 09:40

    You need to clear you object buffer on server side. I am using PHP as my server side language and I faced similar problem and the solution was cleaning my buffer using ob_clean();

    0 讨论(0)
  • 2020-11-30 09:40

    i had the same problem and fixed this by converting the file from utf-8 to utf-8 without BOM

    0 讨论(0)
  • 2020-11-30 09:55

    If your files are encoding with UTF-8, better to encode them with UTF-8 without BOM. This can be easily done through notepad++. The steps are as follows,

    1. Open your files in notepad++.
    2. Go to Encoding option on the file menu.
    3. Then select the option "convert to UTF-8 without BOM".

    This may resolve your problem.

    0 讨论(0)
提交回复
热议问题