How do I fill the info field with server information
How do I fill the info field with server information
Fl0x23
Posts: 4Questions: 1Answers: 0
Hello people,
I would like to enter an information in the same position as "table_info". The entry should contain the server time. Since the server time unfortunately can not be queried by Javascript, I had the idea to jquery them via PHP script. My problem now is that I do not get the info in the field. It is certainly because it is asyncron but how can i solve it?
Here is a detail:
$.getJSON('./update.php', function(data) {
console.log(data); <- I need this information in the info field.
}); |
|
|
$(document).ready(function () { |
var table = $('#table').DataTable({ |
"infoCallback": function (response) { |
<- here ------------------------------------+
}
});
});
Many thanks in advance.
This discussion has been closed.
Answers
Hi @Fl0x23 ,
Can't you just store that time data in a variable and access it later in the
infoCallback
?Cheers,
Colin
@colin
Thank you for you answer, but how should that work? The reponse of php file comes later.
Regrads
Fl0x23
Ah, I see. The
infoCallback
is called every draw, line 2, you could set the variable to "data", then force a table draw withdraw()
- passing in"page"
will keep the paging, ordering and searching the same.C
Do you have a example please?
It works thank you very much.
Ah, sorry, I forgot the
draw()
: