jQuery.ajax servlet return a file [duplicate]
问题 This question already has an answer here : How to download file from httpServlet with Jquery? (1 answer) Closed 2 years ago . I'm pretty new to jQuery and ajax and i have a question. In a jsp I call function downloadDocument(documentId){ var action = "attachment.do"; var method = "downloadDocument"; var url = action + "?actionType="+method+"&documentId=" + documentId; $.ajax({ url: url, dataType: "json", type: 'POST', success: function(data){ alert("downloaded!"); }, error: function (request,