Export a document file using jquery
jquery Add Download Component
Jquery.download =function(URL, data, method) {if(URL &&data) {Data=typeofdata = = ' String '?Data:jQuery.param (data); varInputs = ' '; Jquery.each (Data.split (' & '),function(I,el) {varPair = This. Split (' = '); Inputs+ = ' <input type= "hidden" name= "' + pair[0] + '" value= "' + pair[1] + '"/> ';}); JQuery (' <form action= ' + URL + ' "method=" ' + (method| | ') Post ') + ' > ' +inputs+ ' </form> '). AppendTo (' body '). Submit (). remove (); }; };
JS method call
$.download ("interface", {name:name}, "GET");
Background data, if there is a Chinese place, the parameters need to be converted (reason: Jquery.param (data), the conversion stitching will make Chinese garbled);
Background Java Conversion Code:
Name=urldecoder.decode (name; " Utf-8 ")
Package jquery Download File component