Once again I have run into an issue with one of those big hosting companies. This time it involves running an old version of php, 4.4 to be exact. While this may work for most things if you’re not getting so technical, and I didn’t really think I was, but of course it turns out something I take for granted (running php 5.3 on my production servers) caught me off guard.
I had a simple ajax call for a comment form. Send off the info and send an email out, very simple right. Well if you brush up on your php versions you’ll find that json_encode isn’t available till php version 5.2. So while the ajax call was working, my expected response was not.
So I started searching for a way to mimic the json output to send back, I cam across a post on Stack Overflow that pointed back to the PHP doc’s site on json_encode, and down in the comments boukeversteegh had posted an easy to use function to do exactly what i was looking for.