Vote count:
0
I'm getting this error from my script, weird thing is, it still works. It still runs and changes the values just fine.
Uncaught TypeError: Cannot read property 'company_id' of undefine.
Here's my code:
for(i=0; i<=getUsersCount; i++){
var user = null;
var uCompany = null;
if(getUsers.data[i].company_id === null) uCompany = "Trego";
else uCompany = getUsers.data[i].company[0].name;
user = '<tr><th scope="row" class="u'+i+'">'+getUsers.data[i].user+'</td><td class="u'+i+'">'+getUsers.data[i].email+'</td><td class="u'+i+'">'+getUsers.data[i].first+'</td><td class="u'+i+'">'+getUsers.data[i].last+'</td><td class="u'+i+'">'+uCompany+'</td><td><center><button type="button" id="edit'+getUsers.data[i].id+'" class="btn btn-success" data-toggle="modal" data-target="#eUserModal"><span class="glyphicon glyphicon-pencil" style="color:#FFF" aria-hidden="true"></span></button> <button type="button" id="delete'+getUsers.data[i].id+'" class="btn btn-danger" data-toggle="modal" data-target="#dUserModal"><span class="glyphicon glyphicon-trash" style="color:#FFF" aria-hidden="true"></span></button></center></td></tr>';
$('#getUsersTable').append(user);
}
It's not a huge thing just annoying having an error in my console. Any ideas?
asked 43 secs ago
Uncaught TypeError: Cannot read property 'company_id' of undefined
Aucun commentaire:
Enregistrer un commentaire