All,
I’ve got the following HTML/PHP on my page:
if(isset($_GET['user_id']) && $_SESSION['role']=="admin"){
$user_id = $_GET['user_id'];
}else{
$user_id = $_SESSION['user_id'];
}
?>
<button id="print_timeline" value="<?php echo $user_id; ?>">Print Timeline</button>
When I click the button I’ve got the following jQuery:
jQuery("#print_timeline").click(function(event){
var user_id = jQuery(this).val();
window.location.href = site_url + 'print.php/?user_id=' + user_id;
});
I’m trying to get print the print.php page without leaving my current page and just have the printer properties open to print my print.php page. On my print.page I’ve got the following code to print it automatically:
<body onload="window.print()">
Any idea how I can achieve this?
Thanks!
when you do
window.location.href=...you are leaving your current page. You’ll probably want to usewindow.opento open a ‘popup’ and keep the original page still on