Javascript – Hit Http Url & Download The Response As A File

The use case is:- there is a remote web service which exposes an http endpoint .When you hit the endpoint it returns you csv data. You have to write a javascript program which will hit the url and then download the csv file automatically. May be you can have an html file with a button .So, when you click the button it will download the file.

Please make sure you look for CORS configuration in the remote web service. Hope this helps. Worked for me too.
Happy learning … :)

Leave a Comment

Your email address will not be published. Required fields are marked *

Menu Title