javascript - Save as Diaolog doesn't appear when downloading file (Using AJAX to call servlet) -


i calling download servlet on click of download button. call ajax call using xmlhttprequest object.

var xhr = new xmlhttprequest();  xmlhttp.open("post","servlet",true); //servlet 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'm getting:

the save dialog doesn't appear although fiddler shows document in response.

server side : header('content-type',//mmime type); header('content-disposition', 'attachment; filename=test.txt');


Comments