This article is a mirror article of machine translation, please click here to jump to the original article.

View: 20218|Reply: 2

[JavaScript] JS exports the file via GET POST download

[Copy link]
Posted on 5/21/2021 2:39:18 PM | | | |
Sometimes, we need to GET or POST to download the file, and the stream returned directly from the backend can be downloaded directly through the browser using the GET method if there is no authentication, but because authentication is required, it is not the verification of cookies, which makes things a bit troublesome.
The renderings are as follows:



js code:


Resources:

The hyperlink login is visible.
The hyperlink login is visible.
The hyperlink login is visible.




Previous:Application Offline Files for IIS Deployment Update Sites (app_offline.htm)
Next:Eclipse IDE Maven sets up Alibaba Cloud image acceleration
 Landlord| Posted on 5/21/2021 2:42:17 PM |
The hyperlink login is visible.
xhrReq.open(method, url);
xhrReq.open(method, url, async);
xhrReq.open(method, url, async, user);
xhrReq.open(method, url, async, user, password);
async can select an optional boolean parameter to indicate whether the operation is performed asynchronously, which defaults to true. If the value is false, the send() method will not return until an answer is received. If true, notifications of completed transactions are available to event listeners. If the multipart property is true, this must be true, otherwise an exception will be thrown.
 Landlord| Posted on 5/21/2021 2:47:44 PM |
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com