Open pdf in new tab with jQuery

I've the following code working properly which opens a pdf downoloaded in the same window:

jQuery('<form action="'+ url +'" method="'+ (method||'post') +'">'+inputs+'</form>')
    .appendTo('body').submit().remove();

I'd like open the pdf in a new tab or window.. How can I change the appendTo in order to achieve it?

Thanks in advance!!

Answers 1

  • I think you can use $.ajax or $.post to get pdf url and you can use window.open() to open this url in new tab:)


Related Articles