I'm writing an AJAX application and decided to make use of the JSON data format to communicate between PHP and JavaScript. Using a PHP module from http://www.aurore.net/ gives me two functions, json_encode() and json_decode(). The problem comes when returning this data back to the JavaScript.
All data I return to the JS from my PHP script gives me the data with a silly colon at the front of it. It matters not if I use return json_encode("success"); or if I simply use return TRUE;. For instance, I would receive :success or :1.
Either way, the data gets to the JS and I try to eval() it and I get a syntax error because of the colon immediately preceding the string data.
Is this an issue with PHP in general? Anyone have experience with such a problem? I am at a complete loss. 😕