I have a simple contact form for download excel file . Main issue happen , When ajax load .I want to download excel file then redirect user to a next page.. Below is my code wit
By using https://github.com/johnculviner/jquery.fileDownload js:
$.ajax({
type: "POST",
url: "/site/ajaxexcel.php",
data: {'value':'send'},
cache: false,
success: function(html)
{
$.fileDownload("ajaxheader.php",
{
successCallback: function (url) {
location.href = '';
},
failCallback: function (responseHtml, url) {
alert('error');
}
});
}
});
And at php side add below line in headers:
header("Set-Cookie: fileDownload=true; path=/");