Does not send post parameter in ajax.data
Does not send post parameter in ajax.data
Wilmer30
Posts: 33Questions: 10Answers: 1
The cod is as follows:
var table = $('#datatable').DataTable({
// "processing": true,
"serverSide": true,
"ajax": '<?php echo base_url() ?>documentos/getDocExpAjax',
"type": 'POST',
"data": {
"id": $("#expedientes").val()
},
});
The id parameter does not send to the server.
It may be something simple but I have not solved it, thanks for your help
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
First you can delete this part
<?php echo base_url() ?>
. The script is client side working and does not have access to your php environment on the server.Thanks for your prompt reply, but base_url() is indistinct, because it is actually converted to:
controller/documents/getDocExpAjax
I think the problem is you haven't put your ajax parameters inside
{}
. The only parameter being used is the URL. This example will help:https://datatables.net/examples/server_side/post.html
Need to put your
'data
parameter inside the{}
also.Kevin
Thanks kthorngren I have to be careful in the syntax.