Save since Diaolog does not appear when loading a file (using AJAX to invoke the servlet)

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); //servlet will be the servlet name       
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');    
xmlhttp.send(....); 

xhr.onreadystatechange = function(){
    if (this.readyState == 4 && this.status == 200){

        //some logic
 }}

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');

+4
source share

All Articles