我的php文件:example_061.php創建PDF返回,一切正常。呼叫php文件,其中使用jQuery AJAX函數返回PDF
現在我想打電話給使用jQuery AJAX該文件在我的屏幕讓這一點,我嘗試:
$("#proba").click(function() {
//in here we can do the ajax after validating the field isn't empty.
$.ajax({
url: "tcpdf/examples/example_061.php",
type: "POST",
async: true,
data: {
ime: $("#ime").val(),
pozicija: $("#pozicija").val(),
jmbg: $("#jmbg").val()
}, //your form data to post goes here as a json object
dataType: "html",
success: function(response) {
window.open('example_061.pdf');
},
});
});
一切都很好,所以成功的功能工作的我收到警告信息,但我沒有得到PDF文件作爲下載或在屏幕上。我該怎麼做?
在PHP文件的末尾我有:/ /關閉和輸出PDF文件 return $ pdf-> Output('example_061.pdf','I'); –
有很多* Ajax-like下載*在那裏...這是我自己的例子:https://github.com/gasparesganga/jquery-ajax-downloader – Eggplant
你正在使用哪個PDF庫?你有什麼選擇 - >輸出()? –