Skip to content

Instantly share code, notes, and snippets.

@webOS101
Created September 12, 2014 01:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webOS101/ffced5f262d63e0380e6 to your computer and use it in GitHub Desktop.
Save webOS101/ffced5f262d63e0380e6 to your computer and use it in GitHub Desktop.
Ajax Sample
enyo.ready(function() {
enyo.kind({
name: 'AjaxSample',
components: [
{ kind: 'Button', content: 'Fetch Repositories', ontap: 'fetch' },
{ name: 'repos', content: 'Not loaded...', allowHtml: true }
],
fetch: function() {
var ajax = new enyo.Ajax({
url: 'https://api.github.com/users/enyojs/repos'
});
ajax.go();
ajax.response(this, 'gotResponse');
},
gotResponse: function(sender, response) {
var i, output = '';
for(i = 0; i < response.length; i++) {
output += response[i].name + '<br />';
}
this.set('$.repos.content', output);
}
});
new enyo.Application({name:'app', view: 'AjaxSample'});
});
name: Ajax Sample
description: A simple Ajax sample
authors:
- Roy Sutton
normalize_css: no
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment