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

Popular posts from this blog

Microsoft Visio 2010 Premium Product Keys

Mercedes Benz Diesel CDI EGR Emulator Circuit Diagrams

Fix: The Diagnostic Service Host service failed to start due to the following error. [ solved, no kidding ]