Skip to content

Instantly share code, notes, and snippets.

@fernandofleury
Created July 23, 2014 15:39
Show Gist options
  • Save fernandofleury/13e417a0812ecdf50115 to your computer and use it in GitHub Desktop.
Save fernandofleury/13e417a0812ecdf50115 to your computer and use it in GitHub Desktop.
nick.js
(function bootstrapNick() {
var $app, $view,
nick = {
init: function(){
$app = document.querySelector('[nick-app]');
$view = document.querySelector('[nick-view]');
console.log('inicializado com sucesso');
},
loadView: function(url){
var AJAX = new XMLHttpRequest();
AJAX.addEventListener("load", function(){
$view.innerHTML = this.responseText;
}, false);
AJAX.addEventListener('error', function() {
console.log('erro ao carregar a view');
});
AJAX.open("get", url, true);
AJAX.send();
}
}
nick.init();
nick.loadView('home.html');
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment