<p class="menu">
<ul>
<li>
<label><span>标题:</span><input type="text" name="conf[title][11407482948]" size="12" value="111"></label>
<label><span>链接:</span><input type="text" name="conf[url][11407482948]" size="18" value="aaa"></label>
<label><span>排序:</span><input type="text" name="conf[order][11407482948]" size="2" maxlength="2" value="1"></label>
</li>
<li>
<label><span>标题:</span><input type="text" name="conf[title][31407483086]" size="12" value="222"></label>
<label><span>链接:</span><input type="text" name="conf[url][31407483086]" size="18" value="bbb"></label>
<label><span>排序:</span><input type="text" name="conf[order][31407483086]" size="2" maxlength="2" value="2"></label>
</li>
<li>
<label><span>标题:</span><input type="text" name="conf[title][21407483086]" size="12" value="333"></label>
<label><span>链接:</span><input type="text" name="conf[url][21407483086]" size="18" value="ccc"></label>
<label><span>排序:</span><input type="text" name="conf[order][21407483086]" size="2" maxlength="2" value="3"></label>
</li>
<li>
<label><span>标题:</span><input type="text" name="conf[title][11407483086]" size="12" value="444"></label>
<label><span>链接:</span><input type="text" name="conf[url][11407483086]" size="18" value="ddd"></label>
<label><span>排序:</span><input type="text" name="conf[order][11407483086]" size="2" maxlength="2" value="4"></label>
</li>
</ul>
</p>
jquery如何遍历以下表单的数据成一个数组:
以下是我想得到的数组,用php打印出来的结果
Array
(
[conf] => Array
(
[title] => Array
(
[11407482948] => 111
[31407483086] => 222
[21407483086] => 333
[11407483086] => 444
)
[url] => Array
(
[11407482948] => aaa
[31407483086] => bbb
[21407483086] => ccc
[11407483086] => ddd
)
[order] => Array
(
[11407482948] => 1
[31407483086] => 2
[21407483086] => 3
[11407483086] => 4
)
)
)
------解决方案--------------------
<?php
if($_POST) {
echo '<xmp>';
print_r($_POST);
exit;
}
?>
<script src=scripts/jquery-1.8.3.min.js></script>
<script>
$(function() {
f = $('<form>').html($('.menu').html()).serialize();
$.post(location.href, f, function(d) { alert(d) });
});
</script>
<p class="menu">
<ul>
友情提示:垃圾评论一律封号 加我微信:826096331拉你进VIP群学习群