[eluser]eoinmcg[/eluser]
The way I usually handle ajax is to extend Controller with MY_Controller.php and add this method:\
Code:
function _is_ajax()
{
return (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'));
}
then in your ajax controller you can check like this
Code:
function ajax()
{
if(!$this->_is_ajax())
{
die('Not an Ajax request');
}
//rest of code goes here
}