Ask a phpexcel question 
Recently in a project, you need to export the query processed tabular data to the client's Excel, because the page table data is not directly queried from the database, but calculated and so on. There is a button on the page, the OnClick event uses Ajax to pass some necessary parameters to the server, exportexcel.php the file to receive the parameter and then query the database, processed, and finally exported to the Excel file using Phpexcel. 
So the problem is, the test found that Ajax has been executed, but the browser will not pop-up window to download the exported Excel file, no response. What to do to use Ajax to pass parameters to exportexcel.php, and to pop up the download save window? 
Code for AJAX 
function Excel (Url1,params) 
{ 
try{ 
var xhr = new XMLHttpRequest (); 
}catch (Trymicrosoft) { 
try{ 
var xhr = new ActiveXObject ("Msxml2.xmlhttp"); 
}catch (Othermicrosoft) { 
try{ 
var xhr = new ActiveXObject ("Microsoft.XMLHTTP"); 
}catch (failed) { 
var xhr = false; 
} 
} 
} 
var url=url1+ "?" + "&r=" +math.random (); 
Xhr.open ("POST", url,true); Readystate=1 
Xhr.setrequestheader ("Content-type", "application/x-www-form-urlencoded"); 
Xhr.send (params); 
xhr.onreadystatechange= function () 
{ 
If equals 4, indicates that the interaction is complete, we can take out the contents returned by the server 
if (xhr.readystate== 4 && xhr.status== 200) 
{ 
 
} 
} 
} 
 
exportexcel.php code is not a problem, I tested it alone, can pop up the download window. 
Please expert guidance under, how to do, have troubled me for several days, has not figured out a way to 
 
------Solution-------------------- 
If you don't use Ajax and pass parameters with a connection, do you do that? 
------Solution-------------------- 
Correct it. 
 
function Excel (Url1,params) {   
Window.location = url1+ "?" + "&r=" +math.random () + "&" + params;
}