How to check if the request is an AJAX request with PHP Posted on September 11, 2016 by Chandan Sharma in ajax, Article, CodeIgniter, JavaScript, JQuery, PHPif (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ) { // This is ajax request. // write your code here. }Share this:TwitterFacebook Published by Chandan Sharma View all posts by Chandan Sharma