0
I would like when saving an input and updating the div with the new information, in the return message "Success" ajax, to also print the div. Example
success : function(response){
$("#containerResultado").html(response);
var divToPrint = document.getElementById('divresultado');
var popupWin = window.open('', '_blank', 'width=800,height=600');
popupWin.document.open();
popupWin.document.write('<html><body onload="window.print()">' + divToPrint.innerHTML + '</html>');
popupWin.document.close();
}
Thanks for the feedback. I had the idea to do with iframe that for my case works even better: <iframe id="printf" name="printf"></iframe>
var newWin = window.frames["printf"];
newWin.document.write('<body onload="window.print()">dddd</body>');
newWin.document.close();
– Pedro