Hi,
I have a page with a print button. When I click that button, a pdf is generated
by CF and sent to the client using cfdocument, mime-type application/pdf and a
header content-disposition so that the pdf is treated as an atachment. That
works fine if I don't use Ajax. But I can't get this to work using Ajax.
I try to do this using this Jquery:
function printInvoice(){
$.ajax({
url:"/?event=invoice.print",
data:{invoiceId:$("input[name=invoiceId]").attr("value")},
success:function(data){location.href="/?event=invoice.list";},
async:false,
type:"get"
});
location.href="/?event=invoice.list";
return false;
}
As you can see, when the pdf is retrieved the onsuccess callback should refresh
the page. This refreshing does work but the pdf is not displayed - I don't get
a window asking me if I want to save or view the attachment I get when not
using Ajax.
How can I get this to work?
Marc
fwiw - I use ModelGlue 3.1 and CF 9.0.1 on Mac OS X. JQuery 1.4.2
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340278
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm