JSON reading data

Hello
this is the code
enyo.kind({
    name: "App",
    components: [
        {kind: "Button", ontap: "tapped", content: "Load data"},
        {name: "List", tag: "ul", allowHtml: true},
    ],
    rendered: function(){
        var request = new enyo.JsonpRequest({
           url: "http://api.ihackernews.com/page?format=jsonp",
            callbackName: "callback",
        });
      request.go({ });
        request.response(enyo.bind(this, "processSearchResults"));
	request.error(enyo.bind(this, function() {
   this.log("ERROR");
   this.log(arguments);
}));
  
    },
    tapped: function(){

    },
    processSearchResults: function(inRequest, inResponse){
	alert(typeof inResponse);
	alert(inResponse.length);
	
   //    enyo.forEach(inResponse, function(){ this.$.List.createComponent({content: inResult.title, tag: "li"});}, this)
      //      enyo.forEach(inResponse.items, function(){this.$.List.createComponent({content: output, tag: "li"});}

    }
});
The problem is that I can't read data in processSearch function ,even inResponse.length it shows "undefined"
I can see the object called sucessfully in the network log :"enyo_jsonp_callback_0({"nextId":null,"items":[{"title":"..."

Comments

Sign In or Register to comment.