I am using Jquery an dynamically creating number of rows. if I want to send it to server how can I send that data. I tried using form but that did not work
I am using the following code:
$(document).ready(function() {
// Add button functionality
$("table.dynatable button.add").click(function() {
var master = $(this).parents("table.dynatable");
var prot = master.find(".prototype").clone();
prot.attr("class", "")
master.find("tbody").append(prot);
});
In the body I have:
<th>Numbere</th>
<th><button class="add">Add</button></th>
</tr>
Also here why do we need
prot.attr("class", "")
I am able to add dynamically the number of entries I want. But having issue sending this data to the server using HTTP.
I want to use Ajax call but how to extract and get the data here.
$.ajax({
url: "/temp",
type: "post",
data: data,
dataType: "json",
contentType:
<input type='text' name='testField[]'>It should help if you are using PHP on server side. If not you can use:prot.attr('name', 'someNewName');But remember that you should change id alsoserialize()?