These are the options available in t_plan table
        id    plan_name
        --    ---------
        4  -  free
        5  -  Gold
        6  -  Silver
        7  -  Platinum
        etc

        My object is to as user click on an option in the form it will populate the
        following input boxes next to select box from the data of t_plan table.

        So i store the id of plan in a hidden inputbox 
        and send that value to controller so that it can
        fetch the corrosponing data from the t_plan table and 
        populate the following.

        PLAN-PRICE
        RESUME-LIMIT
        DAY-LIMIT
        JOB-LIMIT
        NO-OF-USER-ALLOW

        Here is my code(in view)
        ------------------------
        <script>
$(document).ready(function(){
//PLAN GOLD, BRONZE, SILVER etc 
$('#plan2_list').change(function(){
   $('#plan2_id').val($("#plan2_list option:selected").val());  
   var zplan = $('#plan2_id').val();
            $.ajax({
                type: "POST",
                url: "<?php echo base_url();?>super_admin/get_plan_value_by_id/+zplan",
                data: {"zplan": zplan},
                       success: function(data) {
                       //alert("SUCCESS");
                       //print_r($result);
                       alert(data.zplan);
                      },
                       error: function(e) {
                       alert("ERROR");
                      }
            });
});     
});
</script>

zplan display the correct data which i am sending to my controller:

My Controller
=============

    public function get_plan_value_by_id($zplan){
        $data=array();
        alert(data.email);   = $this->sa_model->select_plan_by_id(zplan);
        echo  alert(data.email);
        $data['admin_maincontent'] = $this->load->view('admin/add_employer_form',$data,TRUE);
        $this->load->view('admin/admin_master',$data);
    }

My Modal
=============

public function select_plan_by_id($zplan){
    $this->db->select('*');
    $this->db->from('t_plan');
    $this->db->where('plan_id',$zplan);
    $query_result=$this->db->get();
    $result = $query_result->row();
    //echo "<pre>";
    //print_r($result);
    //exit();
    return $result;
}       

But it say "undefined"
or give "error"

I am new in ajax implementaion in codeigniter

Please help

Just a tip. Try the PREVIEW in the forum editor to avoid messes like your post here.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.