I have a jQuery login form that uses $post function to send credentials to the php script that checks the credentials againts the users in the database.
I have been using PHP 5.2 and have been using echo json_encode($data); in my php scripts to send back error messages to the login form witout any issues. The problem is now I have a client that has PHP 4.4.1 installed and it doesn't recognise this command and throw the following error.
Fatal error: Call to undefined function: json_encode()
Is there an equivalent to json_encode() in version PHP 4.4.1?
Any help would be great.
Thanks in advance.
You should use this wrapper function: http://www.boutell.com/scripts/jsonwrapper.html. All you need to do with this solution is to include
that json_encode.php and it will do a function_exists
check. If it is doesn't exist, it adds the function.