CodeIgniter:使用Ajax在主页面中传递值

I need to pass a value in the index() of my controllor called Product.

Here is the 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 is the product controller

public function index(){

//PASS THE VALUE IN THE RELATED VIEW
$data['c_vid'] = $this->input->post('vid');
$data['modal_edit_pdf'] = $this->load->view('modal/edit-pdf', $data, NULL, TRUE);

....
}

Using the scripts above I cannot pass the value in the index() of the product controller.
I do not know if the jquery url is wrong or not:

url:'<?php echo site_url('product');?>'

Your quotes are buggy. Use

url:'<?php echo site_url("product");?>',

Or

url:'<?php echo site_url(\'product\');?>',

First should work, try it.