Reload ajax with parameters
Reload ajax with parameters
aurelien
Posts: 2Questions: 1Answers: 0
Hello,
I'm trying to implement a search form. The goal is to refresh datatable automatically.
Here is my code:
var table = $('#tableRapport').DataTable({
"ajax": {
"url": $('#urlRecherche').text(),
"type": "POST",
"data": {
dateDeb: $('#dateDeb').val(),
dateFin: $('#dateFin').val(),
},
},
});
$('#dateDeb, #dateFin').change(function() {
table.ajax.reload();
});
The problem is here:
dateDeb: $('#dateDeb').val(),
dateFin: $('#dateFin').val(),
When I call the "reload" function, fields are not updated with "val ()".
A solution?
Thanks
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
When declaring the AJAX
data
fields use functions, for example:Hello,
Oh yes! It works ;)
Thanks!