public function doAddReferencesAction() { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); $user = PR_Session::getSession(PR_Session::SESSION_USER); $UserID = $user["UserID"]; $core = new PR_Api_Core_CandidateClass(); $CandidateprofileID = $user["CandidateProfileID"]; $ajaxRes = array('success' => 0, 'info' => null); $request = $this->getRequest(); $params = $request->getParams(); //echo "testt:<pre>";print_r($params);echo("</pre>"); if (!empty($params["referencename"]) && !empty($params["referenceemail"])) { $core->addReferences($CandidateprofileID, $params["referencename"], $params["referenceemail"], $params["referencecomment"]); $ajaxRes['success'] = 1; } else { if (empty($params["referencename"])) { $ajaxRes['success'] = 0; $ajaxRes['info'] = "References name not empty"; } if (empty($params["referenceemail"])) { $ajaxRes['success'] = 0; $ajaxRes['info'] = "References mail not empty"; } } $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); }