PDA

View Full Version : An error occurred! SyntaxError: JSON.parse: unexpected character


squibthat
Jan 18, 2013, 05:16 AM
I get this error "An error occurred! SyntaxError: JSON.parse: unexpected character" on close examination using firebug on the XHR tab I realize that my response as these strange characters � ( black diamond shaped mark with a white question mark at the center) that is preventing me from using the json data I retrieved from mysql usiing PHP json_encode and passed back using jquery's ajax method, your assistance will be highly appreciated

squibthat
Jan 21, 2013, 08:18 AM
I finally located and solved the problem; one of my php files had a bad non UTF8 encoded character perhaps because I had copy pasted it from another application (WORD I think) in my netbeans it was given as a warning "Saw U+0000 on stream.." I really hope this answer helps some other person this error as given me sleepless nights.
My solution was to carefully copy the code to a new file avoiding the illegal character