how to detect ajax request
ajax request will send additional header
if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest')
echo 'ajax';
ajax request will send additional header
if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest')
echo 'ajax';