From 081ac9d44dab334c748c0f7e763c97d55fb9bdf1 Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Mon, 22 Nov 2010 14:42:53 -0600 Subject: Adding is_ajax_request() method to CI_Input --- system/core/Input.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'system') 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 -- cgit v1.2.3-24-g4f1b