Javascript/JQuery noob here, so apologies.
I'm using .ajax
to get a JSON object then the code below to loop through and append the fields to the page. Easy.
$.each(data, function(i, item) {
$(#div-ipos).append(
<img src= + item.user.avatar_small_url + >
+ item.user.first_name
+ <hr /><br />
);
});
It works and the output is as expected, complete with the avatar path passed into an <img>
tag.
However I get the following error:
TypeError: 'undefined' is not an object (evaluating 'item.user.avatar_small_url')
What do I need to do to that variable to make it behave properly in this context?