Tag : ajax request in php

How to Detect AJAX Request using PHP

Detecting AJAX request is very useful, while your are working in AJAX based pagination. Last day worked in a project and I need to detect ajax or direct post request. Following script help me to detect AJAX request. Very simple but efficient script. if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'){ //If AJAX Request Then }else{ //something else } Was this information useful? [...]