JQuery ajax functions only return the xml, text, json, html, and other types, and do not have the "stream" type. Therefore, we need to implement ajax download, the corresponding ajax function cannot be used for file download. However, you can use js to generate a form, use this form to submit parameters, and return "stream" type data. The page is not refreshed during implementation.
The Code is as follows:
Var form = $ ("
"); // Define a form
Form. attr ("style", "display: none ");
Form. attr ("target ","");
Form. attr ("method", "post ");
Form. attr ("action", "exportData ");
Var input1 = $ (" ");
Input1.attr ("type", "hidden ");
Input1.attr ("name", "exportData ");
Input1.attr ("value", (new Date (). getMilliseconds ());
$ ("Body"). append (form); // place the form in the web
Form. append (input1 );
Form. submit (); // form submission
Source: http://www.cnblogs.com/sydeveloper