Welcome Guest, Not a member yet? Register   Sign In
how to use jquery autocomplete in codeigniter
#1

[eluser]goldensona[/eluser]
Hi

help me how to use jquery autocomplete in codeigniter i tried but the code didnt populate.

this is my view home.php

Code:
[removed][removed]
[removed][removed]
    <link rel="stylesheet" type="text/css" href="<?php echo base_url()."jquery-autocomplete/jquery.autocomplete.css"?>" />

[removed]//autocomplete function
    $().ready(function() {
     function formatItem(row) {
        return row[0] ;
    }
    function formatResult(row) {
        return row[0].replace(/(<.+?&gt;)/gi, '');
    }
    
        $("#country").autocomplete('searcheasy/view', {
        matchContains: true,
        minChars: 0,
        mustMatch: true,
        autoFill: true

    });
    
  
    });

this is my controller searcheasy.php

Code:
function view()
{
  $q = $this->input->post('country',TRUE);
        if (!$q) return;
  $this->load->database();
  $this->load->model('dbsearch');
  
     $data = $this->dbsearch->getdata(); //Search DB
    
        foreach($data as $row =>$key)
        {
           // if (strpos(strtolower($key), $q) !== false) {
                echo $key."\n";
         //   }
            
         }      
      $this->load->view('home',$data);
}



this is my model dbsearch.php

Code:
var $namearr=array();

function getdata() {

$data=$this->db->get('countrytable');
foreach ($data->result_array() as $row)
{
   $id= $row['id'];
   $name=$row['countryname'];
   $namearr=$this->array_push_assoc($namearr,$id,$name);
}
return $namearr;
}

function array_push_assoc($array, $key, $value)
{
$array[$key] = $value;
return $array;
}


i cant get the country list out in text box.suggest me to solve this.

thankyou
sona


Messages In This Thread
how to use jquery autocomplete in codeigniter - by El Forum - 08-20-2010, 02:00 AM
how to use jquery autocomplete in codeigniter - by El Forum - 08-20-2010, 02:15 AM
how to use jquery autocomplete in codeigniter - by El Forum - 08-20-2010, 02:33 AM
how to use jquery autocomplete in codeigniter - by El Forum - 08-20-2010, 02:36 AM
how to use jquery autocomplete in codeigniter - by El Forum - 08-20-2010, 02:44 AM
how to use jquery autocomplete in codeigniter - by El Forum - 08-20-2010, 02:49 AM
how to use jquery autocomplete in codeigniter - by El Forum - 08-20-2010, 05:05 AM
how to use jquery autocomplete in codeigniter - by El Forum - 08-20-2010, 05:07 AM
how to use jquery autocomplete in codeigniter - by El Forum - 08-20-2010, 05:19 AM
how to use jquery autocomplete in codeigniter - by El Forum - 08-20-2010, 11:14 PM
how to use jquery autocomplete in codeigniter - by El Forum - 08-24-2010, 11:58 PM
how to use jquery autocomplete in codeigniter - by El Forum - 08-25-2010, 02:39 AM



Theme © iAndrew 2016 - Forum software by © MyBB