$request = Vtiger_Request::getInstance(); $mode = $request->getMode(); if ($mode === 'ajax') { // handle AJAX request } elseif ($mode === 'raw') { // handle raw request } else { // handle other types of requests }In this example, we use the getMode function to determine the type of request and then handle it appropriately. The Vtiger_Request class is a part of the VtigerCRM package library.