Welcome Guest, Not a member yet? Register   Sign In
jQuery UI Autocomplete with CI ??
#32

[eluser]goldensona[/eluser]
hi thanks a lot to you pickupman. i used you controller file , now no error shows but autocomplete didnt populate i dont know why ? is anything we have to changed in the autocomplete.js file?

we used post for getting the autocomplete response , i cant see the difference .

this is whole code after i changed the controller file

changed the config.php

Code:
//Global define for AJAX Requests
define('IS_AJAX', isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');

js part search.php

Code:
< cript t  ype="text/javascript" src="&lt;?php echo base_url()."jquery-ui-1.8.4.custom/development-bundle/jquery-1.4.2.js"?&gt;">[removed]
< cript t  ype="text/javascript" src="&lt;?php echo base_url()."jquery-ui-1.8.4.custom/development-bundle/ui/jquery.ui.core.js"?&gt;">[removed]
  < cript t  ype="text/javascript" src="&lt;?php echo base_url()."jquery-ui-1.8.4.custom/development-bundle/ui/jquery.ui.widget.js"?&gt;">[removed]
  < cript t  ype="text/javascript" src="&lt;?php echo base_url()."jquery-ui-1.8.4.custom/development-bundle/ui/jquery.ui.position.js"?&gt;">[removed]
< cript type="text/javascript" src="&lt;?php echo base_url()."jquery-ui-1.8.4.custom/development-bundle/ui/jquery.ui.autocomplete.js"?&gt;">[removed]


    
[removed]
//Javascript
$("input[name='singlecity']").autocomplete({
        source: function(req, add){
                $.ajax({
                    url: '&lt;?php echo site_url('searchs');?&gt;',
                    dataType: 'json',
                    type: 'POST',
                    data: req,
                    success: function(data){
                        if(data.response =='true'){
                           add(data.message);
                        }
                    }
                });
        },
        minLength: 3,
        select: function(event, ui){
            $(this).end().val(ui.item.value);
        }
     });
[removed]
&lt;/head&gt;

&lt;body&gt;
&lt;input type="text" name="singlecity"  size="48"&gt;

&lt;/body&gt;


my model file searchcity.php


Code:
&lt;?php
class Searchcity extends Model {

function Searchcity() {
// load the parent constructor
parent::Model();
}


function citysearch($search)
{
   if(empty($part_number)) return FALSE; //nothing to search

   $this->db->like('city', $search);

   $query = $this->db->get('tablenames');
  
  
  
   if($query->num_rows() > 0)

       return $query->result();

  return FALSE;
}  

}
?&gt;



this is my searchs.php controller file


Code:
&lt;?php
class Searchs extends Controller{
  
function Searchs(){
// load Controller constructor
parent::Controller();
// load the model we will be using
$this->load->model('searchcity');
// load the database and connect to MySQL
$this->load->database();
// load the needed helpers
$this->load->helper('url');
}

function index(){
    
     $search = $this->input->get('term');
        
     $data['response'] = 'false';
  
     $result = $this->searchcity->citysearch($search); //Search DB
     if($result != FALSE)
     {
        $data['response'] = 'true'; //Set response
        $data['message'] = array(); //Create array
        foreach($result as $row)
        {
          
            $data['message'][] = array('label'=> $row->id, 'value'=> $row->city); //Add a row to array
        }
     }
    
     if(IS_AJAX)
     {
         echo json_encode($data); //echo json string if ajax request
     }else{
         $this->load->view('search',$data); //Load html view of search results
     }
  }  

}  
?&gt;


what i have to change in my code


thanks

sona


Messages In This Thread
jQuery UI Autocomplete with CI ?? - by El Forum - 04-30-2010, 07:22 PM
jQuery UI Autocomplete with CI ?? - by El Forum - 05-01-2010, 03:27 AM
jQuery UI Autocomplete with CI ?? - by El Forum - 05-01-2010, 04:21 AM
jQuery UI Autocomplete with CI ?? - by El Forum - 05-01-2010, 04:25 AM
jQuery UI Autocomplete with CI ?? - by El Forum - 05-01-2010, 05:15 AM
jQuery UI Autocomplete with CI ?? - by El Forum - 05-01-2010, 05:34 AM
jQuery UI Autocomplete with CI ?? - by El Forum - 05-01-2010, 05:41 AM
jQuery UI Autocomplete with CI ?? - by El Forum - 05-01-2010, 10:13 AM
jQuery UI Autocomplete with CI ?? - by El Forum - 05-01-2010, 10:20 AM
jQuery UI Autocomplete with CI ?? - by El Forum - 05-01-2010, 11:36 AM
jQuery UI Autocomplete with CI ?? - by El Forum - 05-01-2010, 08:46 PM
jQuery UI Autocomplete with CI ?? - by El Forum - 05-02-2010, 09:19 AM
jQuery UI Autocomplete with CI ?? - by El Forum - 05-02-2010, 09:41 AM
jQuery UI Autocomplete with CI ?? - by El Forum - 05-02-2010, 09:02 PM
jQuery UI Autocomplete with CI ?? - by El Forum - 05-02-2010, 09:08 PM
jQuery UI Autocomplete with CI ?? - by El Forum - 06-08-2010, 12:39 PM
jQuery UI Autocomplete with CI ?? - by El Forum - 06-08-2010, 01:01 PM
jQuery UI Autocomplete with CI ?? - by El Forum - 06-08-2010, 06:29 PM
jQuery UI Autocomplete with CI ?? - by El Forum - 06-08-2010, 06:56 PM
jQuery UI Autocomplete with CI ?? - by El Forum - 06-09-2010, 09:18 AM
jQuery UI Autocomplete with CI ?? - by El Forum - 06-09-2010, 10:01 AM
jQuery UI Autocomplete with CI ?? - by El Forum - 06-09-2010, 10:53 AM
jQuery UI Autocomplete with CI ?? - by El Forum - 07-02-2010, 01:45 PM
jQuery UI Autocomplete with CI ?? - by El Forum - 07-02-2010, 02:15 PM
jQuery UI Autocomplete with CI ?? - by El Forum - 07-02-2010, 03:23 PM
jQuery UI Autocomplete with CI ?? - by El Forum - 07-02-2010, 03:25 PM
jQuery UI Autocomplete with CI ?? - by El Forum - 07-02-2010, 03:33 PM
jQuery UI Autocomplete with CI ?? - by El Forum - 07-02-2010, 09:08 PM
jQuery UI Autocomplete with CI ?? - by El Forum - 09-08-2010, 11:40 PM
jQuery UI Autocomplete with CI ?? - by El Forum - 09-09-2010, 06:39 AM
jQuery UI Autocomplete with CI ?? - by El Forum - 09-09-2010, 06:50 AM
jQuery UI Autocomplete with CI ?? - by El Forum - 09-09-2010, 11:25 PM
jQuery UI Autocomplete with CI ?? - by El Forum - 09-10-2010, 06:52 AM
jQuery UI Autocomplete with CI ?? - by El Forum - 10-03-2010, 11:43 AM
jQuery UI Autocomplete with CI ?? - by El Forum - 10-03-2010, 12:20 PM
jQuery UI Autocomplete with CI ?? - by El Forum - 10-03-2010, 03:07 PM
jQuery UI Autocomplete with CI ?? - by El Forum - 10-03-2010, 03:14 PM
jQuery UI Autocomplete with CI ?? - by El Forum - 10-08-2010, 12:20 AM
jQuery UI Autocomplete with CI ?? - by El Forum - 10-08-2010, 02:02 AM
jQuery UI Autocomplete with CI ?? - by El Forum - 10-08-2010, 02:27 AM
jQuery UI Autocomplete with CI ?? - by El Forum - 10-08-2010, 03:29 AM
jQuery UI Autocomplete with CI ?? - by El Forum - 10-08-2010, 06:53 AM
jQuery UI Autocomplete with CI ?? - by El Forum - 10-20-2010, 01:22 PM
jQuery UI Autocomplete with CI ?? - by El Forum - 10-20-2010, 01:53 PM
jQuery UI Autocomplete with CI ?? - by El Forum - 10-20-2010, 02:01 PM
jQuery UI Autocomplete with CI ?? - by El Forum - 07-15-2011, 10:46 AM
jQuery UI Autocomplete with CI ?? - by El Forum - 07-15-2011, 10:59 AM
jQuery UI Autocomplete with CI ?? - by El Forum - 07-15-2011, 11:57 AM
jQuery UI Autocomplete with CI ?? - by El Forum - 07-27-2011, 12:59 PM
jQuery UI Autocomplete with CI ?? - by El Forum - 07-27-2011, 01:25 PM
jQuery UI Autocomplete with CI ?? - by El Forum - 07-27-2011, 02:40 PM



Theme © iAndrew 2016 - Forum software by © MyBB