Detect JSON Ajax requests by the response content-type (like is done with XML). Fixes #5709.
This commit is contained in:
parent
230614b4df
commit
787f271052
3 changed files with 26 additions and 2 deletions
|
@ -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} }';
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue