Onchnage event fire and get id in controller using ajax |
Hello guyz i need help in ajax when onchange event fire in dropdown i want the value in controller but i did not get it
Here is mu code: VIEW: <select name="user_role" id="user_role" onchange="calculate(this)"> <option>--Select User--</option> <?php foreach ($roll_get as $roll) { ?> <option value="<?php echo $roll->user_id; ?>" id="<?php echo $roll->user_id; ?>"><?php echo $roll->full_name; ?></option> <?php } ?> </select><br> AJAX: function calculate(id) { var id=id; $.ajax({ type:'POST', url:'welcome/user_manager', data:{'id':id}, success:function(data){ } }); } CONTROLLER: public function user_manager() { $id=$this->input->post('id',true); }
(07-17-2018, 08:27 AM)php_rocs Wrote: @jaydevvara, Thank You dear,I got id value in ajax but i still did not get id in controller
You need to use Ajax to post the id to the controller after getting it.
. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(07-17-2018, 11:31 PM)Pertti Wrote:(07-17-2018, 09:18 PM)jaydevvara Wrote: Thank You dear,I got id value in ajax but i still did not get id in controller Thank you for suggestion ![]()
(07-17-2018, 11:31 PM)Pertti Wrote:(07-17-2018, 09:18 PM)jaydevvara Wrote: Thank You dear,I got id value in ajax but i still did not get id in controller Thank you for suggestion ![]() |
Welcome Guest, Not a member yet? Register Sign In |