Skip to content

Instantly share code, notes, and snippets.

@nicholasess
Last active August 29, 2015 14:04
Show Gist options
  • Save nicholasess/b1e59c4c4ab3bef5c56f to your computer and use it in GitHub Desktop.
Save nicholasess/b1e59c4c4ab3bef5c56f to your computer and use it in GitHub Desktop.
ajax
<h1>Home</h1>
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body nick-app>
<div nick-view></div>
<script>
var nick = {
app: document.querySelectorAll('[nick-app]'),
view: document.querySelectorAll('[nick-view]'),
init: function(){
},
loadView: function(object){
var oReq = new XMLHttpRequest();
oReq.addEventListener("load", function(){
console.log(this.responseText);
}, false);
oReq.open("get", object['view'], true);
oReq.send();
}
}
nick.init();
nick.loadView({
view: 'home.html'
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment