CodeIgniter Forums

Full Version: Prototype and Multiple Drop Downs
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]ccachor[/eluser]
So I'm doing some drop downs but I can't seem to get my controller to accept the post value from my form. Here's what my jscript looks like
Code:
function getModels(){

    var url = 'http://localhost/dropdown/getModels/';

    var pars = $F('make');

    var myAjax = new Ajax.Request(url, {

            method: 'post',

            parameters: pars,

            onSuccess: successModels

        });

}

My controller

Code:
function getModels()

    {
        
        $make  = $this->input->post('make');
            
        $data['query'] = $this->db->query('select distinct model from inventory where make = "$make" ');
                        
        $this->load->view('dropdowns/models', $data);
            
      }

In Firebug the post displays what I want it to but for some reason it won't set for the SQL. I'm thinking it has something to do with the URI stuff or something. I can't figure it out! BTW my select id in my html is all correct. Just think it has something to do with CI.

El Forum

[eluser]patos[/eluser]
hi,
Code:
function getModels(){

    var url = 'http://localhost/dropdown/getModels/';

    var pars = $F('make');

    var myAjax = new Ajax.Request(url, {

            method: 'post',

            parameters: 'make='+pars,

            onSuccess: successModels

        });

}
should be better

El Forum

[eluser]ccachor[/eluser]
Ok nevermind I got it to work! I switched out some of the javascript and post my param to the url and just set my variable using the uri segment.