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

// 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.

More Similar Posts

No results found.

Menu