Shahbaz Kaware

Shahbaz Kaware

  • 1.1k
  • 535
  • 29.8k

How to open PDF in new window using jquery ajax with wcf

Jan 13 2020 5:23 AM
function DownloadPDF(DocName, DocNo, callbackwc) {
debugger;
var D3 = sessionStorage.getItem("logInUserIdADNIC");
var D4 = sessionStorage.getItem('logInUserSessionADNIC');
if ((DocNo || '') == '') {
parent.alertify.alert("Invalid document");
return;
}
var D1 = 'viewProvDoc';
var inputs = 'ViewPDF?D1=' + D1 + '&D2=' + DocNo + '&D3=' + D3 + '&D4=' + D4; + '"}';
callbackwc = callbackwc || function () { };
$.ajax({
type: "POST",
url: serviceUrl + inputs,
data: JSON.stringify(inputs),
success: function (data, textStatus, jqXHR) {
var ws = window.open("data:application/pdf" + data, "width=800,height=600,location=no,menubar=no,status=no,titilebar=no,resizable=yes")
//// var pdfWin = window.open("data:application/pdf;base64, " + data, '', 'height=650,width=840');
//// some actions with this win, example print...
return callbackwc();
},
error: function (jqXHR) {
//showError("...");
alert('Errror!!!');
}
});
}
 
 
 
The above is my jquery aajax code how do i open a PDF in new window plz help. 

Answers (1)