public function enquireAction() { $serviceManager = $this->getServiceLocator(); $this->enquiryTable = $serviceManager->get('Productsite\\Model\\EnquiryTable'); $this->enquiryTable->createEnquiry($this->getRequest()->getPost()->toArray()); $response = $this->getResponse(); $response->setStatusCode("302"); $headers = new \Zend\Http\Headers(); $location = new \Zend\Http\Header\Location(); $location->setUri('/productsite/catalog/index'); $headers->addHeader($location); $response->setHeaders($headers); return $response; }
public function enquireAction() { $request = $this->getRequest(); $serviceManager = $this->getServiceLocator(); $this->chaseTable = $serviceManager->get('Productsite\\Model\\ChaseTable'); $this->chaseTable->createChase($request->getPost()->toArray()); if ($request->isXmlHttpRequest()) { $response = $this->getResponse(); $response->setStatusCode(200); $response->setContent(\json_encode(array('success' => TRUE))); return $response; } else { $response = $this->getResponse(); $response->setStatusCode("302"); $headers = new \Zend\Http\Headers(); $location = new \Zend\Http\Header\Location(); $location->setUri('/'); $headers->addHeader($location); $response->setHeaders($headers); return $response; } }