I invoke the download servlet by clicking the download button. Call - AJAX call using the XMLHttpRequest object.
var xhr = new XMLHttpRequest();
xmlhttp.open("POST","servlet",true);
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlhttp.send(....);
xhr.onreadystatechange = function(){
if (this.readyState == 4 && this.status == 200){
}}
Errors I get:
The Save As dialog box does not appear, although Fiddler indicates that the document is in response.
server side: header ('Content type', // mmime); header ('Content-Disposition', 'attachment; filename = test.txt');
source
share