res.download() not working in my case

前端 未结 2 1282
眼角桃花
眼角桃花 2020-11-28 14:40

I am using nodejs and expressjs framework to download a file \'jsonFile.json\' from server.

i am using the following code

res.get(\'/download\', fun         


        
2条回答
  •  臣服心动
    2020-11-28 15:02

    Just to confirm what @robert said,

    because this thing turned my head for two days, instead of using an ajax call, open a new window with your ajax request location, for example:

    window.open("http://yourserver.com/api/link?a=3&b=4")
    

    hope this helps someone.

提交回复
热议问题