call back in enyo

Hello

my problem is that i can not use call back in my code . i don't know how can i use it ?
in my code :https://jsfiddle.net/y3d3cc3L/6/
in module.exports i wrote some code for loginPage after i clicked the button in ligon page i want to go to home panel
i have some request in module.exports such as :
 var xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function() {

if (this.readyState = 4 && this.status == 200) {
obj = JSON.parse(this.responseText);

for (indexOfItems = 0; indexOfItems < obj.result.items.length; indexOfItems++) {
for (j = 0; j < 6; j++) {
urlList[k] = obj.result.items[indexOfItems].Content[j].image.url;
titleList[k] = obj.result.items[indexOfItems].Content[j].title;
desList[k] = obj.result.items[indexOfItems].Content[j].description;

idList[k] = obj.result.items[indexOfItems].Content[j].id;

k++;
}
}

}

}

xmlHttp
.open(
"GET",
"",
false);
xmlHttp.setRequestHeader("key", obj4.result.key, false);
xmlHttp.setRequestHeader("client_type", "2", false);
xmlHttp.send(null);

before i get urllist json data i use urllist in kind of scrolImageList i used urlList[i] but it returns me undefined:
setupItem : function(sender, ev) {

var imageUrl = '='
+ urlList[1];

Id++;
ev.item.$.image.setSrc({
'hd' : utils.format(imageUrl, '132x132'),
'fhd' : utils.format(imageUrl, '198x198')
});
ev.item.$.title.content = titleList[1];
ev.item.$.des.content = desList[1];
i++;

},
and if you have any other suggestion for request i would appreciate.

Comments

Sign In or Register to comment.