ajax.reload() not working as per my requirement.
ajax.reload() not working as per my requirement.
saleemkh
Posts: 6Questions: 1Answers: 0
Hi,
Here's my code:
table = $('#example').DataTable( {
"processing": true,
"serverSide": true,
"ajax": {
"url":"<?=base_url()?>customer/serverScript",
"data":{
"scope":scope,
"service":service,
"status":status,
"inquiryfrom":$('#inquiryfrom').val(),
"inquiryto":inquiryto
}
}
} );
Now when I use table.ajax.reload(), it sends the old 'inquiryfrom' value instead of getting the new one.
How can the 'data' be resubmitted with the reload()?
Thank you.
This discussion has been closed.
Answers
Sorry guys!!!! I was using it wrong. Should have used it like this.
i have an object like the one in your first example that i use in several places, including regular jquery ajax requests. having to do it the second way creates redundancy. is there a way to pass a plain object to data that will be rechecked when i call ajax.reload()?
Sure -
ajax.data
notes that you can use a plain object. However, if you want it to be evaluated on every submit (as would be the case for @saleemkh's code) you need to use it as a function.Allan