PHP Function Check if Request is Ajax or Regular HTML
PHP Function Code to Determine if the Current PHP Code is Running in Response to an Ajax Request or Regular HTTP (from top of page to bottom) Request
Home
Short:
/* ------------------------------------------------ simple function to return if the current code is running via ajax request or regular http request ------------------------------------------------- */ function isAjaxRequest() { return isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] === 'XMLHttpRequest'; }
source code home