2016-10-11 4 views
-1

iwie jquery .last() zu übergeben. Nach (Wert)

i einen Code von Jquery habe helfen müssen, php, die automatisch durch ein Drücken der Taste erzeugt wird, aber ich weiß nicht, wie es zu PHP passieren

hier ist meine jQuery-Code

$(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'); 
     } 
    }); 

}); 

i ajax

$(function(post()) { 
    $.ajax({ 
     type: "POST", 
     url: 'p1process.php', 
     data: ({ 
      tbl2: "300" 
     }), 
     data: ({ 
      tbl3: "300" 
     }), 
     data: ({ 
      tbl5: "300" 
     }), 
     data: ({ 
      tbl6: "300" 
     }), 
    }); 
}); 
+0

Sie Ajax verwenden können, oder bilden einreichen – guradio

+0

nicht so viele Zeit –

+0

versucht, ich habe Arbeit versucht, was? Im OP sind – guradio

Antwort

0
$.ajax({ 
    type: 'POST', 
    url: 'p1process.php', 
    dataType: "json", 
    data: { 

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

    } 

}); 
versucht haben,

Verwenden Sie diese

0

Sie können Ajax verwenden, um Eingabedaten zu senden. Beispiel unten

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