0
我需要在控制器的index()中傳遞一個名爲Product的值。CodeIgniter:使用Ajax在主頁面中傳遞值
這裏是jQuery代碼:
$(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);
}
});
});
});
這是產品控制器
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);
....
}
使用上述我的腳本在索引不能通過值()的產物控制器。
我不知道,如果jQuery的URL是錯誤的或不:
url:'<?php echo site_url('product');?>'
index()中的值是什麼? –