The Learner
The Learner

Reputation: 3917

sending data to the server in a page using Jquery

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: 

Upvotes: 0

Views: 90

Answers (1)

ripu1581
ripu1581

Reputation: 300

You can extract data from an HTML table to an associative array (JSON object) and then post it to the server

How to extract data into associative array from HTML table using jQuery?

http://encosia.com/use-jquery-to-extract-data-from-html-lists-and-tables/

Upvotes: 2

Related Questions