ajax怎么提交整个form表单

ajax怎么提交整个form表单


呼啦一阵风
浏览 1157回答 1
1回答

斯蒂芬大帝

$.fn.SetWebControls = function (data) {var $id = $(this)for (var key in data) {var id = $id.find('#' + key);if (id.attr('id')) {var type = id.attr('type');if (id.hasClass("input-datepicker")) {type = "datepicker";}var value = $.trim(data[key]).replace(/ /g, '');switch (type) {case "checkbox":if (value == 1) {id.attr("checked", 'checked');} else {id.removeAttr("checked");}break;case "select":id.ComboBoxSetValue(value);break;case "selectTree":id.ComboBoxTreeSetValue(value);break;case "datepicker":id.val(formatDate(value, 'yyyy-MM-dd'));break;default:id.val(value);break;}}}}var formdata= $("#form1").SetWebControls(); //获取整个表单的数据var datavalue={name:"1",pass:"2"}$("#form1").SetWebControls(datavalue); //将数据给整个表单
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JQuery