[eluser]Cristian Gilè[/eluser]
[quote author="cahva" date="1296108845"]BTW, $_POST is a superglogal and is always defined so using isset($_POST) wont work. Better to check if its an ajax request. If you use CI2, you can use what kirkaracha told you or simply put this:
Code:
define('IS_AJAX', isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
..to application/config/constants.php
With that constant its easy to know if its an ajax request or not.[/quote]
Input class is not loaded when routes are processed so $this->input->is_ajax_request() doesn't work. isset($_POST) or define a constant are the best solution.
Cristian Gilè