CodeIgniter Forums
Prototype and Multiple Drop Downs - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Prototype and Multiple Drop Downs (/showthread.php?tid=4931)



Prototype and Multiple Drop Downs - El Forum - 12-25-2007

[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.


Prototype and Multiple Drop Downs - El Forum - 12-25-2007

[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


Prototype and Multiple Drop Downs - El Forum - 12-25-2007

[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.