Created
July 23, 2014 15:39
-
-
Save fernandofleury/13e417a0812ecdf50115 to your computer and use it in GitHub Desktop.
nick.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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