CodeIgniter Forums
_remap ignoring IS_AJAX call? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: _remap ignoring IS_AJAX call? (/showthread.php?tid=44082)



_remap ignoring IS_AJAX call? - El Forum - 08-02-2011

[eluser]chamilyan[/eluser]
I have a controller called redirect.php that redirects from and to views. This controller for the most part has one public _remap function that does all the redirecting with a case statement. Everything has been working great until I sent a $.POST from a view back to the controller. I want it to hit the _remap and look for the fact that the request is coming from AJAX then do it's case.

I have a
Code:
IS_AJAX
constant I'm checking against.

Code:
define('IS_AJAX', isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');

but whenever I hit the page it's always remapping to the default and sending my request to that page where it's basically returning me that pages data back when I'm echoing and alerting the data to and fro.

Any insights?


_remap ignoring IS_AJAX call? - El Forum - 08-02-2011

[eluser]danmontgomery[/eluser]
post the _remap?


_remap ignoring IS_AJAX call? - El Forum - 08-02-2011

[eluser]chamilyan[/eluser]
nevermind, my bad

see http://stackoverflow.com/questions/6915777/remap-ignoring-is-ajax-call

I was using IS_AJAX as a URL function.