SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
Suddenly it happens, your PHP page shows this message in red: "SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data" and you don't know why.
Somewhere in your code, you were using curl and were playing with the headers. You must have inserted this command:
header('Content-Type: application/json');
To Fix this error: you need to insert this statement right after you are done with JSON.
header('Content-Type: text/html; charset=utf-8');
Comments
Post a Comment