private function buscar_cliente() { /// desactivamos la plantilla HTML $this->template = FALSE; $cliente = new cliente(); $json = array(); foreach ($cliente->search($_REQUEST['buscar_cliente']) as $cli) { $json[] = array('value' => $cli->nombre, 'data' => $cli->codcliente); } header('Content-Type: application/json'); echo json_encode(array('query' => $_REQUEST['buscar_cliente'], 'suggestions' => $json)); }
private function buscar_cliente() { $this->template = 'ajax_buscar_cliente'; $this->busqueda = trim($_POST['buscar_cliente']); $cliente = new cliente(); $this->resultado = $cliente->search($this->busqueda); }