/** * Search the record for the Select2 JQuery Object by ajax * @return json */ public function searchAction() { if ($this->getRequest()->isXmlHttpRequest()) { $term = $this->getParam('term'); $id = $this->getParam('id'); if (!empty($term)) { $term = "%{$term}%"; $records = Domains::findbyCustomFields("CONCAT(d.domain, '.', d.tld) LIKE ?", $term); die(json_encode($records)); } if (!empty($id)) { $records = Domains::find($id); die(json_encode($records)); } $records = Domains::get_domains_active(); die(json_encode($records)); } else { die; } }