Every line of 'download pdf file using jquery ajax' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
41 _downloadPDF() { 42 const pageTitle = encodeURIComponent(document.getElementsByTagName('title')[0].innerText); 43 const currentUrlBase = document.location.href.replace('localhost:8081', 'staging.trase.earth'); 44 const currentUrl = encodeURIComponent(`${currentUrlBase}&print=true`); 45 const pdfUrl = `${PDF_DOWNLOAD_URL}?filename=${pageTitle}&url=${currentUrl}`; 46 window.open(pdfUrl, '_blank'); 47 }
29 function downloadPDFList() 30 { 31 $("#pdfType").attr('value', 'range'); 32 $("#pdfDate").attr('value', $("#date").attr('value')); 33 document.forms["pdf"].submit(); 34 }
120 function download(url) { 121 torrents[url] = true; 122 // If the torrent already exists, kick off the downloads of the files, as this 123 // won't happen naturally when the torrent is added (because it already exists!) 124 if(btapp.has('torrent')) { 125 if(btapp.get('torrent').each(function(torrent) { 126 if(torrent.has('properties')) { 127 if(torrent.get('properties').get('download_url') === url) { 128 download_torrent_files(torrent.get('properties')); 129 return; 130 } 131 } 132 })); 133 } 134 }
10 function download(fileUrl, filename, callback) { 11 https 12 .get(fileUrl, function(response) { 13 if ( 14 response.statusCode > 300 && 15 response.statusCode < 400 && 16 response.headers.location 17 ) { 18 if (url.parse(response.headers.location).hostname) { 19 https.get(response.headers.location, function(res) { 20 writeToFile(filename, res, callback); 21 }); 22 } else { 23 https 24 .get( 25 url.resolve( 26 url.parse(fileUrl).hostname, 27 response.headers.location 28 ), 29 function(res) { 30 writeToFile(filename, res, callback); 31 } 32 ) 33 .on("error", callback); 34 } 35 } else { 36 writeToFile(filename, response, callback); 37 } 38 }) 39 .on("error", callback); 40 }
16 function download(url: string, filename: string) { 17 console.log(`download ${url}...`) 18 return new Promise((resolve) => { 19 request(url, resolve).pipe(fs.createWriteStream(filename)) 20 }); 21 }
237 function download(content, filename, contentType) 238 { 239 if(!contentType) contentType = 'application/octet-stream'; 240 var a = document.createElement('a'); 241 var blob = new Blob([content], {'type':contentType}); 242 a.href = window.URL.createObjectURL(blob); 243 a.download = filename; 244 a.click(); 245 }
10 function download(filename, text) { 11 const blob = new Blob([text], { type: 'text/plain;charset=utf-8' }); 12 13 // release previous url in case of multiple uses in one session 14 if (urls.download) { 15 window.URL.revokeObjectURL(urls.download); 16 } 17 18 // create an addressable version of the blob 19 urls.download = window.URL.createObjectURL(blob); 20 21 const element = document.createElement('a'); 22 element.setAttribute('href', urls.download); 23 element.setAttribute('download', filename); 24 element.style.display = 'none'; 25 document.body.appendChild(element); 26 element.click(); 27 document.body.removeChild(element); 28 }
54 function Download() { 55 $("#spin1").show(); 56 $.ajax({ 57 url: AppRoot + "setup/upgrade/Updater.asmx/Download", 58 data: "{ version: '" + newVersion + "' }", 59 type: "POST", 60 contentType: "application/json; charset=utf-8", 61 dataType: "json", 62 success: function (result) { 63 var rt = result.d; 64 if (rt.length > 0) { 65 $("#spin1").hide(); 66 ShowError("1", rt); 67 } 68 else { 69 ShowSuccess("1"); 70 Extract(); 71 } 72 } 73 }); 74 }
1 function download(file, ext) { 2 var d = new Date(); 3 var n = d.getTime(); 4 if (window.navigator.msSaveOrOpenBlob) // IE10+ 5 window.navigator.msSaveOrOpenBlob(file, n + ext); 6 else { // Others 7 var a = document.createElement("a"), 8 url = URL.createObjectURL(file); 9 a.href = url; 10 a.download = n + ext; 11 document.body.appendChild(a); 12 a.click(); 13 setTimeout(function() { 14 document.body.removeChild(a); 15 window.URL.revokeObjectURL(url); 16 }, 0); 17 } 18 }
505 function download(filename, url) { 506 var a = window.document.createElement('a'), 507 bd = document.querySelector('body'); 508 bd.appendChild(a); 509 a.setAttribute('href', url); 510 a.setAttribute('download', filename); 511 a.click(); 512 bd.removeChild(a); 513 }