Skip to content

How to Detect Ajax Request ?

Last updated on July 7, 2017

The HTTP_X_REQUESTED_WITH header is sent by all recent browsers that support AJAX requests.

if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' )
{
     // something 
}

Download

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments