[eluser]alexsancho[/eluser]
This code works with all major javascript frameworks, and it's easy to include in any ajax library, you only need to send this header with any ajax call.
I've extended the input library to add a function that return TRUE, FALSE,
Code:
function isAjax() {
return (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH']=="XMLHttpRequest");
}
in this way we can check ajax request with
Code:
if($this->input->isAjax()) {
...
}