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

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -