Click here to Skip to main content
15,889,843 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a drop down box which when i select value from it show database row using ajax

i can't do that as i'm new to codeigniter


view

XML
<!--  get  option values from another database table-->
<select >
<?php foreach($x as $content2){ ?>
<option>
<?= $content2->postiontitle ; ?>

</option>
<?php  } ?>

</select>



model

this is the tabel which i fill from options
C#
function get_entery1()
    {
        return $this->db->get('adm_setting')->result();
    }



controller
// i want to show the $content values in div using ajax when select one of the select options
PHP
$users = $this->user->get_entery($title);
       //var_dump($users);

       $content = array(

       'title_page' => 'Admin',
       'title1'=>$title,
       'users_list' =>  $users,


       );
// query databse and send the result  of content1 to view  to fill option values
         $get_title=$this->user->get_entery1();
    $content1=array
    (
      'x'=>$get_title

    );



       $this->load->view('admin',array_merge($content, $content1));
Posted

1 solution

$.ajax({
     async: false,
     cache: false,
     url: "your_web_address?action=clientnetworkpricelist&clientid="+clientid,
     scriptCharset: "utf-8",
     dataType: "html",
     success: function (data) {
         $("#display").html(data);
         $("#flash").hide();
     },
     error: function (request, ajaxOptions, thrownError) {

     }
 });


Try this
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900