使用ajax显示数据库行 [英] show database row using ajax

查看:84
本文介绍了使用ajax显示数据库行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个下拉框当我从中选择值时显示数据库行使用ajax



i不能这样做,因为我是codeigniter的新手< br $>




查看



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

<!--  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

function get_entery1()
    {
        return $this->db->get('adm_setting')->result();
    }







控制器

//我想要选择其中一个选项时,使用ajax显示div中的$ content值




controller
// i want to show the $content values in div using ajax when select one of the select options

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

推荐答案

x as
x as


content2){ >
< 选项 < span class =code-keyword>>
<? =
content2){ ?> <option> <?=


content2 - > postiontitle; ?>

< / option >
<? php } < span class =code-summarycomment>? >

< / select >
content2->postiontitle ; ?> </option> <?php } ?> </select>







型号



这是我从选项填写的表格




model

this is the tabel which i fill from options

function get_entery1()
    {
        return


这篇关于使用ajax显示数据库行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆