mirror of
https://github.com/jquery/jquery.git
synced 2026-04-20 03:01:22 -04:00
Detect JSON Ajax requests by the response content-type (like is done with XML). Fixes #5709.
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
<?php
|
||||
error_reporting(0);
|
||||
if ( $_REQUEST['header'] ) {
|
||||
header("Content-type: application/json");
|
||||
}
|
||||
|
||||
$json = $_REQUEST['json'];
|
||||
if($json) {
|
||||
echo '[ {"name": "John", "age": 21}, {"name": "Peter", "age": 25 } ]';
|
||||
} else {
|
||||
echo '{ "data": {"lang": "en", "length": 25} }';
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user