Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/297.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/88.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
如何将jquery.last().after()值传递给php_Php_Jquery_Html - Fatal编程技术网

如何将jquery.last().after()值传递给php

如何将jquery.last().after()值传递给php,php,jquery,html,Php,Jquery,Html,我需要帮助 我有一个jquery代码,它是通过按下按钮自动生成的,但我不知道如何将它传递给php 这是我的jquery代码 $(document).ready(function() { var cnt = 2; $("#anc_add").click(function() { $('#tbl2 tr').last().after('<tr><td><textarea name="c16_2" id="c16_2" >PO Ite

我需要帮助

我有一个jquery代码,它是通过按下按钮自动生成的,但我不知道如何将它传递给php

这是我的jquery代码

$(document).ready(function() {
    var cnt = 2;
    $("#anc_add").click(function() {
        $('#tbl2 tr').last().after('<tr><td><textarea name="c16_2" id="c16_2" >PO Item [' + cnt + ']</textarea></td><td><input type="date" name="date4_2" id="date4_2" ></input></td><td><textarea style="border: none; width: 100%;-webkit-box-sizing: border-box; -moz-box-sizing:border-box; box-sizing: border-box;" name="d16_2" id="d16_2" cols="10"rows="3" ></textarea></td><td><textarea style="border: none; width: 100%;-webkit-box-sizing: border-box; -moz-box-sizing:border-box; box-sizing: border-box;"  name="e16_2" id="e16_2" cols="10"rows="3"></textarea></td><td><textarea style="border: none; width: 100%;-webkit-box-sizing: border-box; -moz-box-sizing:border-box; box-sizing: border-box;" name="f16_2" id="f16_2" cols="10"rows="3"></textarea></td><td><select style="border: none; width: 100%; -webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing: border-box;"  name="g16_2" id="g16_2" cols="10" rows="3"><option value="Not Started">Not Started</option><option value="On Track">On Track</option><option value="Delayed">Delayed</option><option value="Concern">Concern</option><option value="Completed">Completed</option></select></td><td><textarea style="border: none; width: 100%;-webkit-box-sizing: border-box; -moz-box-sizing:border-box; box-sizing: border-box;" name="h16_2" id="h16_2" cols="10"rows="3"></textarea></td><td><textarea style="border: none; width: 100%;-webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing: border-box;" name="i16_2" id="i16_2" cols="10"rows="3"></textarea></td><td><textarea style="border: none; width: 100%;-webkit-box-sizing: border-box; -moz-box-sizing:border-box; box-sizing: border-box;" name="j16_2" id="j16_2" cols="10"rows="3"></textarea></td></tr>');
        cnt++;
    });


    $("#anc_rem").click(function() {
        if ($('#tbl2 tr').size() > 3) {
            $('#tbl2 tr:last-child').remove();
            cnt--;


        } else {
            alert('One row should be present in table');
        }
    });

});

使用此

您可以使用ajax发送输入数据。下面的例子

$(function () {
    $('formname' ).on('submit', function (e) {
      e.preventDefault();
      $.ajax({
        type: 'post',
        url: 'p1process.php',
        data: $('formname').serialize(),
        success: function () {
            alert('form is submited');
        }
      });
    });
  });

你可以使用ajax或表单submitnot工作我试了这么多次试了什么?包括在OPi中我试过ajax$(函数(post()){$.ajax({type:'post',url:'p1process.php',数据:({tbl2:'300}),数据:({tbl3:'300}),数据:({tbl5:'300}),数据:({tbl6:'300}),;});您不能有多个数据对象。。。。具有相同键的对象将只覆盖它们。。。。
$.ajax({
    type: 'POST',
    url: 'p1process.php',
    dataType: "json",
    data: {

        tbl2: "300",
        tbl3: "300",
        tbl5: "300",
        tbl6: "300"
    }
    success: function(data) {

    }

});
$(function () {
    $('formname' ).on('submit', function (e) {
      e.preventDefault();
      $.ajax({
        type: 'post',
        url: 'p1process.php',
        data: $('formname').serialize(),
        success: function () {
            alert('form is submited');
        }
      });
    });
  });