`table.ajax.reload()` won't work
`table.ajax.reload()` won't work
abhijitghate
Posts: 3Questions: 2Answers: 0
I am having a input field on my front end where I accept a code which is used to fetch data from the backend and display it in datatable. I am making a ajax call to bring that data to the front. But when I change the value in the input field (and try to update data in datatable using table.ajax.reload()
) , the ajax call by the datatable holds on to older code. So the table wont get updated. Please help.
"ajax" : {
url : "/my/url",
dataSrc:"",`
data:{'form':$("#my_id").serialize() , 'csrfmiddlewaretoken':csrf_token},
contentType : "application/json",
complete: function(data){
$(".overlay").hide();
},
success: function(){
console.log("ajax successful");
}
},
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi @abhijitghate ,
I think the problem is because the
data
option for your input cell is being read at table initialisation, and not dynamically. If you make it a function, as in the sixth example on theajax
page, it will read the current value.I hope that helps,
Cheers,
Colin
Thanks Colin!
It sure worked!!
Cheers!!
Abhijit