在刷新之前将数据从jquery检索到php

如何从jquery生成的输入中检索数据来处理它们与php $ _POST?

(function($){ $countForms = 1; $.fn.addForms = function(idform){ var myform = ""+ " "+ " "+ " "+ " "+ " "+ " "+ " "+ "
Field A ("+$countForms+"):Field B ("+$countForms+"):
"; if(idform=='mybutton'){ myform = $("
"+myform+"
"); $("button", $(myform)).click(function(){ $(this).parent().parent().remove(); }); $(this).append(myform); $countForms++; } }; })(jQuery); $(function(){ $("#mybutton").bind("click", function(e){ e.preventDefault(); var idform=this.id; if($countForms<3){ $("#container").addForms(idform); } }); });

html / php代码:

 if ( isset( $_POST['field'] ) ) { echo ''; foreach ( $_POST['field'] as $diam ) { // here you have access to $diam['top'] and $diam['bottom'] echo ''; echo ' '; echo ' '; echo ''; } echo '
', $diam['a'], '', $diam['b'], '
'; } ?>
Field A Field B

我无法从加载页面后jquery生成的重复输入中检索数据。 我知道因为foreach只是回显了html部分中输入的值。 任何建议我如何获取jquery输入的值来处理它们与PHP?