How well supported is JSON across browsers? I just tried the following:
<?php
header('Content-type: application/json');
$arr = array('name' => 'Lisa');
echo json_encode($arr);
?>
and AJAX:
<script type="text/javascript">
$.ajax({
type: 'get',
url: 'php-url-here',
success: function(response){
alert(response.name);
}
});
</script>
This returns the right information from the JSON object, being Lisa, so the real question is, is the JSON response parsed because the browser supports it based on the content type passed or because the ajax function in JQuery supports it? What is the bulletproof way of doing this so it will be supported in all browsers old and new, or most.