NYCPHP Meetup

NYPHP.org

[nycphp-talk] detecting Ajax calls

Rob Marscher rmarscher at beaffinitive.com
Mon Feb 26 11:47:25 EST 2007


>> I am wondering what you guys are doing to detect whether your PHP  
>> script is being called via AJAX or --- "regular."
>>
>> I know Prototype sends a custom headers e.g.
>> [X-Prototype-Version] => 1.5.0 [X-Requested-With] => XMLHttpRequest

I've been checking for
$_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'

jQuery seems to send it as well.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20070226/a702acc4/attachment.html>


More information about the talk mailing list