html与js传json值给php
//一段js代码 var data = {}, act = [], list = []; $('.set').find('input, textarea').each(function() { act[$(this).attr('name')] = $(this).val(); }); $wrap.find('.item').each(function() { var item = {}; $(this).find('input').each(function() { item[$(this).attr('name')] = $(this).val(); }); list.push(item); }); data['act'] = act; data['list'] = list; console.log(data);return; C.ajax({ url: $wrap.data('url'), data: {data: data}, type: 'post', success: function(response) { C.alert('操作成功!'); setTimeout(function() { window.location.href = "list.html"; }, 2000); } });