jquery动态创建form表单
Posted llguanli
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jquery动态创建form表单相关的知识,希望对你有一定的参考价值。
function exportExcel() { var merchantName = $(‘#merchantName‘).val(); var merchantNo = $(‘#merchantNo‘).val(); var orderNo = $(‘#orderNo‘).val(); var phone = $(‘#phone‘).val(); var orderStatus = $(‘#orderStatusCombobox‘).combobox(‘getValue‘); var paidStatus = $(‘#hasPaidCombobox‘).combobox(‘getValue‘); var refundStatus = $(‘#hasRefundCombobox‘).combobox(‘getValue‘); var firstDealStatus = $(‘#firstDealCombobox‘).datebox(‘getValue‘); var createDateFrom = $(‘#createDateFrom‘).datebox(‘getValue‘); var createDateTo = $(‘#createDateTo‘).datebox(‘getValue‘); var opts = $(‘#orderDetailGrid‘).datagrid(‘options‘); var params = { merchantName: merchantName, merchantNo: merchantNo, orderNo: orderNo, phone: phone, orderStatus: orderStatus, paidStatus: paidStatus, refundStatus: refundStatus, firstDealStatus: firstDealStatus, createDateFrom: createDateFrom, createDateTo: createDateTo, page: opts.pageNumber, rows: opts.pageSize }; $("body").append("<form></form>"); $("body").find("form").attr("action", ‘/yami/backend/order.exportOrderDetails.do‘); $("body").find("form").attr("method", "post"); $("body").find("form").attr("style", "display:none"); $.each(params, function (k, v) { $("body").find("form").append("<input type=‘text‘ name=‘" + k + "‘ value = ‘" + v + "‘></input>"); }); $("body").find("form").submit(); }
以上是关于jquery动态创建form表单的主要内容,如果未能解决你的问题,请参考以下文章
jQuery serializeArray 没有获取动态创建的表单元素