如何将$data array ['1']
从控制器传递到定义的js变量serial=$(this).val();
中的视图?
在Controller ::
中public function add_video() {
$query = "SELECT * FROM `video_category`";
$query1 = "SELECT * FROM `video_sub_category`";
$data['1'] = $this->madmin->avideo_category($query);
$data['2'] = $this->madmin->avideo_sub_category($query1);
$this->view_page->admin_page('v_add_video', $data);
}
在View ::
中$(document).ready(function(){
$("#change_category").change(function(){
serial=$(this).val();// $data['1'] will be added here
})
$("#change_sub_category").change(function(){
serial=$(this).val();// $data['2'] will be added here
})
})