I want to send an \"ajax download request\" when I click on a button, so I tried in this way:
javascript:
var xhr = new XMLHttpRequest(); xhr.open(\
I prefer location.assign(url);
location.assign(url);
Complete syntax example:
document.location.assign('https://www.urltodocument.com/document.pdf');
developer.mozilla.org/en-US/docs/Web/API/Location.assign