Adding is_ajax_request() method to CI_Input
diff --git a/system/core/Input.php b/system/core/Input.php
index 52ea71b..6f88b19 100644
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -624,6 +624,21 @@
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