This is an archived forum post. The information may be outdated. Contact us if you have any questions.
<a class="createpdf">Create PDF<a/> <img class="spinner" style="display:none" src="/images/spinner.gif">
{ "success": true, "pdfUrl": "http://myserver/pdfs/doc_01.pdf", "errorMsg": "" }
$('a.createpdf').click(function(event){ event.preventDefault(); $('a.createpdf').hide(); $('img.spinner').show(); $.ajax({ url: "/getpdf.php", type: "POST", dataType: 'json', // .. other options success: function(data) { if (data.success) { showDownloadPdfDialog(data.pdfUrl); } else { showError(data.errorMsg); } error: function() { // handle the error } complete: function() { $('img.spinner').hide(); $('a.createpdf').show(); } }); }