form导出数据

$.exportExcel = function (option) {
	var opts = $.extend({}, {
		url: "",
		fileName: "",
		excelCon: "",
		excelColName: ""
	}, option);

	if ($("#ExcelForm").length == 0) {
		$(document.body).append('<form target="ExcelIframe" id="ExcelForm"><input type="hidden" id="ExcelColName" name="excelColName" /><input type="hidden" id="ExcelCon" name="excelCon" /><input type="hidden" id="ExcelFilename" name="excelFilename"/></form><iframe name="ExcelIframe" style="display:none; visibility: hidden;"></iframe>');
	}
	$("#ExcelFilename").val(opts.fileName);
	$("#ExcelColName").val(opts.excelColName);
	$("#ExcelCon").val(opts.excelCon);
	var excelForm = document.getElementById("ExcelForm");
	excelForm.method = "post";
	excelForm.action = a.url;
	excelForm.submit();
};

 

你可能感兴趣的:(form)