Skip to content

Instantly share code, notes, and snippets.

@Abban
Created January 30, 2013 12:32
Show Gist options
  • Select an option

  • Save Abban/4672981 to your computer and use it in GitHub Desktop.

Select an option

Save Abban/4672981 to your computer and use it in GitHub Desktop.
CodeIgniter function that catches if the current request is an Ajax one.
<?php
/**
* Is Ajax
*
* Returns true or false depending on if the http request was an ajax one or not.
*
* @return boolean
*/
if(!function_exists('is_ajax')){
function is_ajax(){
$ci =& get_instance();
return $ci->input->is_ajax_request();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment