I try to download a file. The action is triggered by ajax()
POST request. The request sends data in JSON format to the controller. The controller gener
As the comments said you can't do it with an ajax call, but you can do it with plain Javascript.
function getLicenseFile() {
var downloadUrl = "${pageContext.request.contextPath}/licenses/rest/downloadLicenseFile";
// (optionally) provide the user with a message that the download is starting
window.location.href = downloadUrl;
}
Note the use of ${pageContext.request.contextPath}
, which is preferred over <%=request.getContextPath()%>
.