0
我有三個視圖文件夾視圖和我想用Ajax調用通過點擊鏈接中的按鈕來顯示類別表和產品表... input.php
同時顯示錶中的數據負載表調用笨
<div class="wrapper">
<div class="container">
<div class="jumbotron">
<h1>View Two Records By Click Event</h1>
</div>
<div id="show-catg">
<?php $this->load->view('show'); ?>
</div>
<div id="show-prd">
<?php $this->load->view('show_pro'); ?>
</div>
,但我想這顯示使用單擊事件..喜歡
<a href="" class="show_catg">Categories</a>
<a href="" class="show_prd">Product</a>
$('.show_catg').click(function(){
url:,
data:,
});
$('.show_prd').click(function(){
url:
data:
});
這是5月控制器類功能
public function index(){
$data= $this->Model_data->getAll_categories();
$data1 = $this->Model_data->getAll_product();
$Dataa = array('categories' => $data,"products"=>$data1);
$this->load->view('input',$Dataa);
}
Model_data類
function getAll_categories(){
$this->db->select('*');
$this->db->from('categories');
$this->db->limit(50);
$this->db->order_by('Catg_ID','ASC');
$query = $this->db->get();
return $query->result();
}
public function getAll_product(){
$this->db->select('*');
$this->db->from('product');
$this->db->limit(50);
$this->db->order_by('Prod_ID','ASC');
$query = $this->db->get();
return $query->result();
}
沒事做類似的方式..但真的需要幫助....:| – Khushi