前台表单动态新增:数据封装
var vo={}; var basePlCloudContentList = []; vo.name = $("input[name='name']").val(); vo.link = $("input[name='link']").val(); vo.dataImg = $("input[name='dataImg']").val(); vo.status = $('select option:selected').val(); var divs = $("#formpart").children(); $.each(divs, function (i, n) { var theme = $(n).find("input[name='theme']").val(); var content = $(n).find("textarea[name='content']").val(); var data = { "theme": theme, "content": content, "contentOrder":i + 1 }; basePlCloudContentList.push(data);//数组的push方法*!/ }); vo.basePlCloudContentList = basePlCloudContentList; $.ajax({ url:prefix + "/save", data:JSON.stringify(vo), type:"post", contentType:'application/json', dataType: 'json', beforeSend: function () { $.modal.loading("正在处理中,请稍后..."); $.modal.disable(); }, success:function (result) { $.operate.successCallback(result); } })