How to check if a Request was made via AJAX in PHP

No Comments
// Check for Ajax Request  
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest') {
    //Do stuff here
}

Image Credits: Photo by Isis França on Unsplash.

Last Updated On March 22, 2018

Related Articles

No results found

Leave a Reply

avatar
  Subscribe  
Notify of
Menu
Copy link