Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

axios download excel file

axios({
  url: 'http://api.dev/file-download',
  method: 'GET',
  responseType: 'blob', // important
}).then((response) => {
   const url = window.URL.createObjectURL(new Blob([response.data]));
   const link = document.createElement('a');
   link.href = url;
   link.setAttribute('download', 'file.pdf'); //or any other extension
   document.body.appendChild(link);
   link.click();
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: dynamically adding marker react native mapbox 
Javascript :: bootstrap cdn for react 
Javascript :: first day of month and last day of month moment js 
Javascript :: get element by multiple class javascript 
Javascript :: jquery alert with yes no 
Javascript :: javascript html encode 
Javascript :: cypress display timestamp in milliseconds 
Javascript :: javascript generate 3 numbers 1 - 49 
Javascript :: convert array string to number 
Javascript :: How to insert divider in react native 
Javascript :: convert timestamp to date javascript 
Javascript :: javascript remove all style values in div 
Javascript :: jquery validator no space 
Javascript :: html javascript find data attribute 
Javascript :: mui how to set background in theme 
Javascript :: javascript alert get text 
Javascript :: how to send static file in express 
Javascript :: drawer navigation set width react native 
Javascript :: nodejs format text 
Javascript :: jquery replace text in button 
Javascript :: vue fetch api 
Javascript :: how to get current date in react js 
Javascript :: webpack set mode to development 
Javascript :: Jquery trigger change event upon dom ready 
Javascript :: properly import mat icon angular 10 
Javascript :: ajax post body parameters 
Javascript :: require express 
Javascript :: dom click is not a function 
Javascript :: get result and write to file node 
Javascript :: javascript current date time 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =