public function newTestAction() { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); $ajaxRes = array('success' => 0, 'info' => null); $params = $this->getRequest()->getParams(); $user = PR_Session::getSession(PR_Session::SESSION_USER); $nameTest = $params['name']; $companyId = $user['CompanyID']; $userId = $user['UserID']; if (!empty($nameTest)) { $core = new PR_Api_Core_TestClass(); //$core->delete() $arrTest = $core->createTest($userId, $companyId, $nameTest); $ajaxRes['info'] = $arrTest; } $response = $this->getResponse(); $response->clearAllHeaders()->clearBody(); $ajaxRes = json_encode($ajaxRes); $response->setHeader('Content-type', 'application/json'); $response->setHeader('Content-Length', strlen($ajaxRes), true)->setBody($ajaxRes); }