I have json data here. I am trying to get data in property_more_images
like this:
getItemImages: function(pid) {
xhr.simpleCall({
query:{
com_option:"item",
item_get_id:pid
},
func:'timeline'
}, function(response) {
if (response.err_code === 0) {
console.log(response.data[0].property_more_images);
var arr = response.data[0].property_more_images;
notice_obj = [];
for (var i = 0, l = arr.length; i < l; ++i) {
notice_obj.push(arr[i]);
}
return notice_obj.join(' ,');
}
});
}
and then use the getItem
function later like this:
getItem: function(pid) {
var $this = $$('.time-line-content .item-content[data-id="'+ pid +'"]');
var item = {
id: $this.data('id'),
nickname: $this.find('.item-header .detail .nickname').html()
};
item.propslider = this.getItemImages(pid);
var output = TM.renderTplById('itemTemplate', item);
$$('#itemContent').html(output);
}
So far my console.log
gives me json data as I expect. When I call the getItemImages
function inside the getItem
function, I don't seem to get any data. Something is wrong with the getItemImages
function. I am not able to figure out what.