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();
}
上一篇:Spark大型电商项目实战-及其改良之番外(1)-将spark前端页面效果高效拷贝至博客


下一篇:HTML-DIV布局