let the browser handle its download issue. and use the below code:
<button id="download" onclick='window.location="download.php?file=filename"'>Download</button>
And from your download.php use $_GET method not $_POST.
you can also try POST method with ajax, but if I try to give you proper method then i will have to test it first. what you can do is(as test) create a div as hidden with some
on
success: function(response)
{
$(document).append("<div id="SomeCrazyId" style="display:none"></div>");
$("#SomeCrazyId").html(response);
}
and see what happen