Welcome Guest, Not a member yet? Register   Sign In
Prototype and Multiple Drop Downs
#1

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

[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
#3

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




Theme © iAndrew 2016 - Forum software by © MyBB