$scope.downLoad=function(id){
var tt =new Date().getTime();
var url = root +‘/ly/fileInfo/download.action?fileInfo.id=‘+id 这是下载文件的URL和参数
var form=$("<form>");//定义一个form表单
form.attr("style","display:none");
form.attr("target","");
form.attr("method","post");//请求类型
form.attr("action",url);//请求地址
$("body").append(form);//将表单放置在web中
var input1=$("<input>");
input1.attr("type","hidden");
input1.attr("name","tt");
input1.attr("value",tt);
form.append(input1);
var input2=$("<input>");
input2.attr("type","hidden");
input2.attr("name","id");
input2.attr("value",id);
form.append(input2);
form.submit();//表单提交
}
时间: 2024-10-13 09:58:58