javascript - Jquery each data object attribute -


i trying create table rows containing data each attribute object response using $.each, id, purpose, , amount coming undefined. have tested response in fiddler , data being received correctly, problem seems in "item" part. here jquery:

$.ajax({         type: "get",         url: "https://chad-test4.clas.uconn.edu/api/commitments/getcommitmentpurposes/2",         contenttype: "application/json; charset=utf-8",         datatype: "json",         success:         function (response) {             var purposes = $("#purposes tbody");              if (response.success == true) {                  purposes.empty();                 var buttons = '<tr><td><button type="button" class="btn-primary">save</button>'                         + '<button type="button" class=".btn-danger">delete</button></td>'                  var list = response.data;                  $.each(list, function (i, item) {                     purposes.append(buttons + '<td><select id=' + item.id + '>' + item.purpose + '</select>'                         + '<td><input type="text" val =' + item.amount + '/>')                 });             }         }         }); }); 

could post snippet of json aswell ?

basically believe need access entries identifier:

$.each( list.items, function(i, item ) {     

but posting json clarify if true.


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -