PHPology is a collective of highly skilled, award winning, web gurus.
Contact Raj on 07985 467 213 or email [email protected]

Returning JSON data from a PHP Script

Now there is always this annoying issue I have that when I am returning data to a JSON request via PHP and try to apply some logic via Javascript - the data that I return back will not want to play ball.

During time this of shouting at my screen with "WHY WHY WHY" - I realise that I forgot this one special line that needs to be added to the PHP code prior to echoing out the json encoded data.

header('Content-Type: application/json');