Download file on click in php

Hide Copy Code. $.ajax({ url:"download.php", method:"post", data:{fileName:fileName}, success:function(e){ alert(e); } }) Your code is sending