Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $('document').ready(function () {
- $('.historyAPI').on('click', function (e) {
- e.preventDefault();
- var href = $(this).attr('href');
- getContent(href, true);
- });
- });
- window.addEventListener("popstate", function (e) {
- getContent(location.pathname, false);
- });
- function getContent(url, addEntry) {
- $.get(url, onAjaxSuccess);
- function onAjaxSuccess(data)
- {
- contentHolder.innerHTML = '';
- contentHolder.innerHTML = data;
- }
- if (addEntry == true) {
- history.pushState(null, null, url);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement