导出使用场景:当前端需要传非常多的参数数据,就需要用到post导出
get请求:
window.location.href = "/CustomOrder/MapRowLinePlan/PlanUseCommunityDown?appCode=CTMS&dataa=" + JSON.stringify(queryFormData);
//伪造post请求:
downloadInfoToExcel("/CustomOrder/MapRowLinePlan/PlanUseCommunityDown?appCode=CTMS", "dataa", JSON.stringify(queryFormData));
downloadInfoToExcel: function (url, paramName, paramValue) {
var $form = $(document.createElement('form')).css({ 'display': 'none' }).attr("method", "POST").attr("action", url);
var $input = $(document.createElement('input')).attr('type', 'hidden').attr('name', paramName).val(paramValue);
$form.append($input);
$("body").append($form);
$form.submit();
}
标签:jQuery,attr,form,input,post,伪造,请求 From: https://www.cnblogs.com/nanxixi/p/16706713.html