function isAjax() { if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) { return $_SERVER['HTTP_X_REQUESTED_WITH'] === "XMLHttpRequest"; } else { return false; } }