aboutsummaryrefslogtreecommitdiffstats
path: root/test/data/json.php
diff options
context:
space:
mode:
authorRick Waldron <waldron.rick@gmail.com>2010-01-05 19:48:16 -0500
committerjeresig <jeresig@gmail.com>2010-01-05 19:48:16 -0500
commit787f271052220c20787104f0eba6441aedac22ff (patch)
tree107b9e9c434ed1b91c0ecc79174d85c85a217e41 /test/data/json.php
parent230614b4df313493813d688b63ab68f3812a0030 (diff)
downloadjquery-787f271052220c20787104f0eba6441aedac22ff.tar.gz
jquery-787f271052220c20787104f0eba6441aedac22ff.zip
Detect JSON Ajax requests by the response content-type (like is done with XML). Fixes #5709.
Diffstat (limited to 'test/data/json.php')
-rw-r--r--test/data/json.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/data/json.php b/test/data/json.php
index d19a41792..d6e0f2fc7 100644
--- a/test/data/json.php
+++ b/test/data/json.php
@@ -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} }';
}
-?> \ No newline at end of file
+?>