Is there anyway to check whether an incoming request is of AJAX JSON type?
I tried
if(($_SERVER[\'REQUEST_METHOD\']==\'JSON\')) { }
You can check the X-Requested-With header, some libraries, like jQuery set it to "XMLHttpRequest".
X-Requested-With
"XMLHttpRequest"
$isAjaxRequest = $_SERVER['X_REQUESTED_WITH'] == 'XMLHttpRequest';