在这里,我想将帖子值传递给以分页方式编写的查询,但是不幸的是,在转到第二页时,查询未获得帖子值。为了获得价值,我将发布价值放在了会话中,那么它也没有传递价值,那么我该如何克服呢?
public function sales_report(){
$data['start_date'] = $start_date = $this->input->post('start_date');
$data['end_date'] = $end_date = $this->input->post('end_date');
$data['type'] = $type = $this->input->post('type');
$user_id=$this->input->post('user_id',FALSE);
$this->session->set_userdata('s_date', $start_date);
$this->session->set_userdata('e_date', $end_date);
$s_date=$this->session->userdata('s_date');
$e_date=$this->session->userdata('e_date');
$limit = 10;
$config['base_url'] = base_url().'app/report/sales_report/';
$config['per_page'] = $limit;
$config['next_tag_open'] = '<div class="next">';
$config['next_tag_close'] = '</div>';
$config['use_page_numbers'] = TRUE;
$config['uri_rsegment'] = 4;
$page_number = ($this->uri->segment(4)) ? $this->uri->segment(4) : 1;
$offset = ($page_number == 1) ? 0 : ($page_number * $limit) - $limit;
$config['total_rows'] = $this->Report_model->count_date_wise_sales_info($s_date,$e_date);
$data['headers'] = $this->Report_model->get_date_wise_sales_info($s_date,$e_date,$config['per_page'],$offset);
$this->load->library('pagination',$config);
$data['page_links'] = $this->pagination->create_links();
$data['products']=$this->db->order_by('id','desc')->get('products')->result();
$this->load->view('app/reports/sales_report',$data);
}
请帮助我解决
答案 0 :(得分:0)
要将PHP值传递给jquery或javascript,必须在PHP文件中创建一个脚本标记,就像这样,我想将base_url传递给jquery。
example.php
<?php
<script type="text/javascript">
base_url = "<?php echo base_url(); ?>";
</script>
?>