php - CodeIgniter: passing value in the main page using Ajax -
i need pass value in index() of controllor called product.
here jquery code:
$(document).ready(function(){ $('.call-edit-pdf').on('click',function(){ var vid = $(this).data('id'); $.ajax({ type: 'post', data:{vid:vid}, url:'<?php echo site_url('product');?>', success: function(result) { $('#val-ajax').html(result); } }); }); });
this product controller
public function index(){ //pass value in related view $data['c_vid'] = $this->input->post('vid'); $data['modal_edit_pdf'] = $this->load->view('modal/edit-pdf', $data, null, true); .... }
using scripts above cannot pass value in index() of product controller.
not know if jquery url wrong or not:
url:'<?php echo site_url('product');?>'
your quotes buggy. use
url:'<?php echo site_url("product");?>',
or
url:'<?php echo site_url(\'product\');?>',
first should work, try it.
Comments
Post a Comment