Welcome Guest, Not a member yet? Register   Sign In
Onchnage event fire and get id in controller using ajax
#1

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);
      

}
Reply


Messages In This Thread
Onchnage event fire and get id in controller using ajax - by jaydevvara - 07-17-2018, 05:43 AM



Theme © iAndrew 2016 - Forum software by © MyBB