load second dropdown values based on the first (how to implement AJAX) |
[eluser]bhakti.thakkar[/eluser]
Hi, i am new to CI. View: Code: [removed] Controller : Code: function get_subprograms($Project_ID) Nothing happens. can anyone please help me in this
[eluser]ELRafael[/eluser]
You didn't call the js function on the first dropdown. Try to put in the drowpdown something like this Code: <!-- put onchange below. the ci forum didn't show what i wrote :( --> You can try use JQuery, I think its a little better. An example: Code: [removed] In this case, every time that select with name states changed, will pass by post (you can change to get) to method search_city the var uf. This var have the id value. In the search_city method you return something like this Code: echo '<option value="'.$city_id.'">'.$city_name.'</option>';
[eluser]bhakti.thakkar[/eluser]
First a big thank for your reply. i am trying to implement JQuery in my application. what files are required to be included or downloaded for implementing JQuery with CI. i am googling a lot but not a single blog did i find which will help me to do the same. any link also which guided me will be appreciated Thanks again. hope you help me
[eluser]ELRafael[/eluser]
www.jquery.com and click download. the downloaded file is the only that you'll need for almost all things. IMO, I don't use Jquery with CI. I just put my js in a external file. When a need a PHP file to do something (like a SQL in database) then I use CI. It's not difficult. I suggest you to use, and when you get doubt, call forum. Maybe another section of CI forum. Good luck.
[eluser]bhakti.thakkar[/eluser]
thanks for that help. i downloaded the .js file and included it. but nothing seems to work. may be i am missing somthing. in the mean while i have tired to do the below. can check what is the problem. i am getting js error : "the requested url not found on the server". but i have done the proper point to the controller/funtion_name/parameter certificate_confirm.php Code: <?$this->load->view('header');?> certificates.php (Controller) Code: <?php project_model.php Code: function getSubprograms($Project_ID) Please please help me. i am going nuts from past 24 hrs. also i have attached the onchangeevent to the dd which is not gettig pasted : onChange="LoadSubprograms(this.value)" <select name="Project_ID" id="Project_ID"> <? foreach($query->result() as $row) { ?> <option name="Project_ID" value="<?=$row->Project_ID?>"><?=$row->Project_ID?></option> <? } ?> </select> |
Welcome Guest, Not a member yet? Register Sign In |