Is there anyway to check whether an incoming request is of AJAX JSON type?
I tried
if(($_SERVER[\'REQUEST_METHOD\']==\'JSON\')) { }
You would need to set a header from the client side. jQuery and other libraries set a x-requested-with header:
x-requested-with
if(strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { echo "Ajax request"; }