Autocomplete JavascriptUI + PHP + Mysql

0

Hi, I'm working on an autocomplete in a CRM but I have a problem I gave a search here and I did not find a solution, so the description below:

I want to make my system more intuitive with auto complete and I am using the following codes:

Controller:

function get_cliente(){
    $this->load->model('commentModel');
    if (isset($_GET['term'])){
      $q = strtolower($_GET['term']);
      $this->birds_model->get_cliente($q);
    }
  }

Model:

function get_cliente($q){
    $this->db->select('cnome');
    $this->db->join('clientes', 'clientes.ccod = comentarios.cliente');
    $this->db->like('cliente', $q);
    $query = $this->db->get('clientes');
    if($query->num_rows() > 0){
      foreach ($query->result_array() as $row){
        $new_row['label']=htmlentities(stripslashes($row['cliente']));
        $new_row['value']=htmlentities(stripslashes($row['ccod']));
        $row_set[] = $new_row; //build an array
      }
      echo json_encode($row_set); //format the array into json data
    }
  }

View: on my system I'm using a layout template (layout.php) where inside I load my views as needed (client_history2.phtml), in case I'm loading the javascript and javascript files -ui.css within the view layout.php and within the view client_history.phtml I have a Modal , and in this modal is the field that I want to implement autocomplete. below the codes:

Files being loaded into layout.php:

<head>

<link href=' <?php echo base_url('assets/calendar/fullcalendar.min.css'); ?>' rel='stylesheet' />
<link href='<?php echo base_url('assets/calendar/fullcalendar.print.min.css'); ?>' rel='stylesheet' media='print' />
<script src="<?php echo base_url("assets/plugins/jQuery/jquery-2.2.3.min.js"); ?>"></script>

<link href="assets/js/jquery-ui.min.css" rel="stylesheet" type="text/css" />

Location of the auto script complete within the view clients_history2.phtml:

<!DOCTYPE html>
<html lang="en">

<head>

<script type="text/javascript">  
    $(function(){
        $("#cliente").autocomplete({
          source: "comments/get_cliente" // path to the get_birds method
        });
    }); 
</script>

Modal to enter data within the view clients_hystory2.phtml:

<!-- Modal de inserir-->
<div class="modal fade" id="new_coment" tabindex="-1" role="dialog" aria-labelledby="modalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
       <div class="modal-header  bg-red">
            <button type="button" class="close" data-dismiss="modal" 
aria-label="Fechar"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="modalLabel">Adicionar Comentario</h4>
  </div>
  <div class="modal-body">

 <?php echo form_open('clientes/inserir_coment', 'id="form-comentarios"'); ?>

<form action="" method="GET" ENCTYPE="multipart/form-data">
  <div class="row">
    <div class="form-group col-md-5">
        <label for="nome">Data</label> <input type="text" class="form-control" id="dat" name="dat"
            placeholder="informe uma data " 
            value="<?php echo date('d/m/y') ; ?>">
    </div>     

    <div class="form-group col-md-5">
        <label for="cliente">Cliente</label> <input type="text" class="form-control" id="cliente" name="cliente"
            placeholder="informe o nome do cliente"
            value="<?php echo isset($view_cliente) ? $view_cliente: '' ; ?>">
    </div>
</div>

Below is the error that returns me when I type something in the #model client field:

Apache log errors:

[Thu May 04 20:24:37.297382 2017] [ssl:warn] [pid 4508:tid 692] > AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name 
[Thu May 04 20:24:37.380539 2017] [core:warn] [pid 4508:tid 692] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run? 
[Thu May 04 20:24:37.728286 2017] [ssl:warn] [pid 4508:tid 692] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name 
[Thu May 04 20:24:38.311381 2017] [mpm_winnt:notice] [pid 4508:tid 692] H00455: Apache/2.4.23 (Win32) OpenSSL/1.0.2h PHP/7.0.9 configured -- resuming
 normal operations 
[Thu May 04 20:24:38.311381 2017] [mpm_winnt:notice] [pid 4508:tid 692] AH00456: Apache Lounge VC14 Server built: Jul  1  2016 11:09:37 
[Thu May 04 20:24:38.311381 2017] [core:notice] [pid 4508:tid 692] AH00094: Command line: 'c:\xampp\apache\bin\httpd.exe -d C:/xampp/apache' 
[Thu May 04 20:24:38.313882 2017] [mpm_winnt:notice] [pid 4508:tid 692] AH00418: Parent: Created child process 1904 
[Thu May 04 20:24:39.975894 2017] [ssl:warn] [pid 1904:tid 656] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name 
[Thu May 04 20:24:40.289374 2017] [ssl:warn] [pid 1904:tid 656] AH01909:  www.example.com:443:0 server certificate does NOT include an ID which matches the server name 
[Thu May 04 20:24:40.340911 2017] [mpm_winnt:notice] [pid 1904:tid 656] AH00354: Child: Starting 150 worker threads.
    
asked by anonymous 04.05.2017 / 12:09

0 answers