Jump to content

Please help, How do I connect the JQuery AJAX get method to add to a table


IrfanT

Recommended Posts

var response = "[{
      "Name":"Xyz",
      "Age":"16",
      "ID":"5"
     },
     {
       "Name":"ABC",
       "Age":"15",
       "ID":"6"
    }]";

// convert string to JSON
response = $.parseJSON(response);

$(function() {
    $.each(response, function(i, item) {
        var $tr = $('<tr>').append(
            $('<td>').text(item.Name),
            $('<td>').text(item.Age),
            $('<td>').text(item.ID)
        ); //.appendTo('#records_table');
        console.log($tr.wrap('<p>').html());
    });
});
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...