Help

Help

mario_amfmario_amf Posts: 1Questions: 0Answers: 0
edited August 2013 in General
Hello,

i need to open a new window and display few number off tables, for now,
i'm testing with only one table, i'm using this code...

[code]
var newWindow = window.open("", "");
newWindow.document.open();


var s = 'Preview Message';
s += '';
s += "<";
s += '/script>';
s += '';
s += "<";
s += '/script>';
s += '';
s += '';
s += "$(document).ready(function() { \
$('table').dataTable(); \
} );";
s += "<";
s += '/script>';
s += '';
newWindow.document.write(s);

$.get('table.html', function(data) {

newWindow.document.write(data);

});

newWindow.document.close();
newWindow.focus();
[/code]

the problem is that datatables Initialisation code doesn't work... can anyone help me with this?

Thanks

Replies

  • aaronwaaronw Posts: 89Questions: 3Answers: 4
    I'm sort of confused, but I don't actually see where you actually have a in that JS that you're writing. Are you doing $.get to insert that into the newwindow? If so, you'd need to call the .dataTable() after that, because the ready event will fire as soon as the write is done. I'm also not really sure what your goal is here, but it's quite difficult to follow your code flow in and out of javascript and html. Why don't you do a $.get for all the data instead of just the table.html?
This discussion has been closed.