$request->ajax()

Checks if this request is an Ajax request

  • return (boolean)
if(kirby()->request()->ajax()) {
  echo 'This is an ajax request';
}