diff options
author | Greg Aker <greg.aker@ellislab.com> | 2010-11-22 21:42:53 +0100 |
---|---|---|
committer | Greg Aker <greg.aker@ellislab.com> | 2010-11-22 21:42:53 +0100 |
commit | 081ac9d44dab334c748c0f7e763c97d55fb9bdf1 (patch) | |
tree | 3aad0c9c083319723518daf753b44e35afeddb5f /system | |
parent | 3a563987be22b542a26c05b21a5691c9dd4ec7be (diff) |
Adding is_ajax_request() method to CI_Input
Diffstat (limited to 'system')
-rw-r--r-- | system/core/Input.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/system/core/Input.php b/system/core/Input.php index 52ea71bc5..6f88b1972 100644 --- a/system/core/Input.php +++ b/system/core/Input.php @@ -624,6 +624,21 @@ class CI_Input { return $this->headers[$index]; } + // -------------------------------------------------------------------- + + /** + * Is ajax Request? + * + * Test to see if a request contains the HTTP_X_REQUESTED_WITH header + * + * @return boolean + */ + public function is_ajax_request() + { + $req_source = $this->server('HTTP_X_REQUESTED_WITH'); + return ($req_source == 'XMLHttpRequest') ? TRUE : FALSE; + } + } // END Input class |