Skip to content

Open PDF export in a new tab?

The export link has the format like this


Insert the following code snippet at end of the page. It should open PDF export in a new tab.

var pdfBtn = $('#<TABLE-NAME>_pager1_left div[title="PDF"]');
var pdfLink = 'https://example.com/phpGrid/export.php?dt=json&gn=<TABLE_NAME>&export_type=PDF'

pdfBtn.on('click', function(event) {
  event.preventDefault();
  window.open(pdfLink, '_blank');
});

Replace <TABLE_NAME> with the actual table name. 

Feedback and Knowledge Base