简体   繁体   中英

Print button on a page which prints another page

I have a page called order where I have Print button. On click to the print I want to print another page called print_this which is there.

 <div class="actions">
  <%= f.submit 'Place order', class: 'btn btn-primary' %>
  <%= f.submit 'Print', class: 'btn btn-primary' %>
</div>

So say the button is at this URL: http://localhost:3000/o/p so on the click of print I want to open http://localhost:3000/orders/1 , ie directly print should pop up.

Please help.

Make hyperlink with print button which will open http://localhost:3000/orders/1?print=true page and in orders page write js code to check passed parameters. if print=true parameter is present in URL trigger window.print()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM