Skip to content Skip to sidebar Skip to footer

'unexpected Token' When Using Json.parse From Array Made In Php

I'm trying to AJAX a JSON array but for some reason when I use JSON.parse it gives me the error: Uncaught SyntaxError: Unexpected token Here is my PHP: $infoJson = array('info' =

Solution 1:

Your output parses fine, except for the invalid, invisible character '\ufeff' at the beginning of the string. This is the UTF-16 byte order mark. You are probably sending the string with an incorrect/missing charset in your Content-Type header.


Post a Comment for "'unexpected Token' When Using Json.parse From Array Made In Php"