Hola amigos estoy recibiendo datos de un ajax y todo bien solo quisiera saber como indagar dentro del objeto y en mi success llenar una tabla, esto es lo que tengo
// -- /get-owners
function getowners(){
$.ajax({
type: 'GET',
url: '/get-owners',
dataType: 'json',
success: (data)=>{
alert(data);
$.each(data,(index,item) => {
alert(index,item);
});
}
});
//$("#ownerT").load();
};
getowners();
// objeto Json que me devuelve
[
{
"id": 3,
"created_at": "2019-03-21T05:20:44.100Z",
"username": "xxxx",
"name": "xxxx",
"lastnameP": "xxxx",
"lastnameM": "xxxx",
"pass": "$2a$10$xvj8YrAT5QP8ezLHEgcAy.Jmslo/x6q/6BjICBtmysfttd3n9Joka",
"mail": "[email protected]",
"admin": null,
"user": null,
"owner": 1,
"gender": null,
"datenac": "1965-03-01T06:00:00.000Z",
"phone": "9611545746",
"calle": null,
"colonia": null,
"estado": null,
"cp": null,
"img": '/somewhere/myimage.jpg',
"id_usercreated": 2,
"status": null
}
]
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
<h3>Owner de proyecto</h3>
<div class="top2 table-wrapper-scroll-y">
<table class="table table-hover">
<thead>
<tr>
<th scope="col">Img</th>
<th scope="col">Name</th>
<th scope="col">Action</th>
</tr>
</thead>
<tbody id="ownerT">
</tbody>
</table>