JS下载
function downloadFile(id) { var url = "<%=request.getContextPath()%>/cer/downloadFile";
var form = $("<form></form>").attr("action", url).attr("method", "post");
form.append($("<input></input>").attr("type", "hidden").attr("name", "fileId").attr("value", id));
form.appendTo('body').submit().remove();//提交之后再删除from表单
}
动态创建from,提交表单
jForm.appendTo('body')
function loadPage(url, projectName) {
var jForm = $('<form></form>', {
action: url,
method: 'post'
}); $("<input>", {
name: 'curPrj',
value: projectName
}).appendTo(jForm); jForm.appendTo('body').submit();
} var form = $("<form method='post'></form>"),
input;
form.attr({ "action": url });
$.each(args, function (key, value) {
input = $("<input type='hidden'>");
input.attr({ "name": key });
input.val(value);
form.append(input);
});
form.appendTo('body').submit();