Created
April 8, 2013 15:17
-
-
Save stvedt/5337586 to your computer and use it in GitHub Desktop.
Demonstration of a gracefully degrading and search engine optimized AJAX technique.
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Example by Stephen Tvedt</title> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> | |
</head> | |
<body> | |
<nav> | |
<a href="index.html">Home</a> | |
<a href="about.html">About</a> | |
</nav> | |
<div id="content"> | |
<h1>About</h1> | |
</div> | |
</body> | |
</html> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Example by Stephen Tvedt</title> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> | |
</head> | |
<body> | |
<nav> | |
<a href="index.html">Home</a> | |
<a href="about.html">About</a> | |
</nav> | |
<div id="content"> | |
<h1>Home</h1> | |
</div> | |
<script> | |
var $content = $('#content'); | |
$('nav a').click(function(e){ | |
e.preventDefault(); | |
var $page = $(this).attr('href'); | |
$content.load($page + ' #content'); | |
window.location.hash = $page; | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment