Reputation: 418
Page doesn't reloads after printing, using PHP laravel framework, tried all the available javascript and jquery page refresh and reload options, nothing is working, the below window.location.href works but printing doesnt happening, very much confused any help could be useful thanks. Using Jquery print plugin and also tried window.print also.
<button type="button" data-dismiss="modal" id="mymodalss">Print</button>
$(document).ready(function() {
$("#mymodalss").click(function(){
var deferredObj = $.Deferred();
$.print("#offer",
{
deferred: deferredObj
}
);
/*this way working with alert, if i remove alert it doesnt work*/
deferredObj.done(function(value) {
alert("Successful in Printing");
window.location.href ="{{URL('/payroll/voucher')}}";
});
});
});
Upvotes: 1
Views: 636
Reputation: 11512
Can you try passing the $.Deferred()
option while going for print like below:
$(document).ready(function() {
$("#mymodalss").click(function(){
//declaring the deferred object in which page will get reloaded/refresh on .done event
var deferredObj = $.Deferred();
deferredObj.done(function(value) {
window.location.reload(true);
});
$.print("#offer",
{
deferred: deferredObj
}
);
});
});
Upvotes: 1