How to use jQuery "$.when" method?
Posted
by
Uder Moreira
on Stack Overflow
See other posts from Stack Overflow
or by Uder Moreira
Published on 2013-06-26T13:50:27Z
Indexed on
2013/06/26
16:21 UTC
Read the original article
Hit count: 135
jQuery
I don't understand from jQuery documentation how "$.when" method works. I'm am new in jQuery, so sorry if my question is too simple.
I am trying to do something like this:
var tableProgress;
tableProgress = "<table id='table-progress'><tr><td></td></tr></table>"
$.when(
$("#send-one").html('done. ' + tableProgress)
).done( function() {
$('#table-progress').dataTable();
} );
It does not work, I think it's because .dataTable() pluggin can't find the table so I am trying to use jQuery $.when.
What I need is: use .datatable pluggin in a table that is inserted in
$("#send-one").html('done. ' + tableProgress)
but, using .datatable() directly may not be synchronous to the insertion.
I also tryied:
$("#send-one").html('done. ' + tableProgress);
$('#table-progress').dataTable();
Could you please help me?
© Stack Overflow or respective owner