Skip to content

Instantly share code, notes, and snippets.

@nfreader
Last active August 29, 2015 14:04
Show Gist options
  • Save nfreader/70df7e06ae1667481e17 to your computer and use it in GitHub Desktop.
Save nfreader/70df7e06ae1667481e17 to your computer and use it in GitHub Desktop.
function loadContent(page, content, dest) {
$(dest).load("view/" + page + ".php " + content + "");
console.log("view/" + page + ".php " + content + " " + dest);
}
function loadPage(page) {
$('#game').load("view/" + page + ".php");
console.log("view/" + page + ".php");
}
$('body').delegate('.load', 'click', function() {
event.preventDefault();
var page = $(this).attr('page');
if (page == undefined) {
var page = $(this).attr('href');
}
var content = $(this).attr('content');
var dest = $(this).attr('dest');
//$('#game').load("view/" + content + ".php");
if (content == undefined && dest == undefined) {
loadPage(page);
} else {
loadContent(page, content, dest);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment