Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何从php中jquery创建的输入类型文本中获取数据_Php_Jquery - Fatal编程技术网

如何从php中jquery创建的输入类型文本中获取数据

如何从php中jquery创建的输入类型文本中获取数据,php,jquery,Php,Jquery,在我的程序中,用户可以通过单击按钮jquery创建。但是php不会将数据发送到另一个页面 jquery: $(document).ready(function(){ var counter = 2; $("#addButton").click(function () { if(counter>10){ alert("Only 10 textboxes allow"); return fals

在我的程序中,用户可以通过单击按钮jquery创建。但是php不会将数据发送到另一个页面

jquery:

$(document).ready(function(){
      var counter = 2;
      $("#addButton").click(function () {
          if(counter>10){
              alert("Only 10 textboxes allow");
              return false;
          }
          var newTextBoxDiv = $(document.createElement('div'))
                  .attr("id", 'TextBoxDiv' + counter);
          newTextBoxDiv.after().html('<label>ویژگی '+ counter + ' : </label>' +
          '<input type="text" name="txt' + counter +
          '" id="textbox' + counter + '" class="form-control" style="margin:5px">');
          newTextBoxDiv.appendTo("#TextBoxesGroup");
          counter++;
      });
  });
php:


为什么不在IT中使用ajax?您尝试发送的变量是什么?这两段代码似乎完全独立。jQuery没有以任何方式调用PHP。您想发出一个ajax请求。将值保存到隐藏字段,然后获取服务器端。我已经尝试过ajax。php无法获取由jquery创建的数据
$x = 1;
while ($x<11)
{
    $name = 'txt' . $x ;
    if(isset($_POST[$name]) && $_POST[$name]!='')
    {
        object::object_Insert($_POST[$name],$s);
    }
    $x++;
}