/** * Insert a user in ol_admins table */ public function addAdminAsyncAction() { // No need to render $this->_helper->viewRenderer->setNoRender(); // Create json object $json = new stdClass(); $json->error = 0; $json->message = ""; // The entire process try { // Get parameters $userName = $this->_getParam("username"); $email = $this->_getParam("email"); $password = $this->_getParam("password"); // Create instance and insert user $users = new OneLogin_Acl_Users(); $users->addUser($userName, $email, $password); $json->message = "User added"; } catch (Exception $e) { $json->error = 1; $json->message = str_replace("'", '', trim($e->getMessage())); } echo $this->_helper->json($json); // Send response }