Fix double loading bug
On an html load, the page was reload by the js "popstate"
This commit is contained in:
parent
77842ab37d
commit
69a8fce64a
|
@ -3,6 +3,7 @@ $(function () {
|
||||||
function () {
|
function () {
|
||||||
$.getScript(this.href);
|
$.getScript(this.href);
|
||||||
history.pushState(null, document.title, this.href);
|
history.pushState(null, document.title, this.href);
|
||||||
|
history_edited = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -11,16 +12,20 @@ $(function () {
|
||||||
function () {
|
function () {
|
||||||
$.getScript(this.href);
|
$.getScript(this.href);
|
||||||
history.replaceState(null, document.title, this.href);
|
history.replaceState(null, document.title, this.href);
|
||||||
|
history_edited = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
$('.form').live('submit', function () {
|
$('.form').live('submit', function () {
|
||||||
$.post(this.action, $(this).serialize(), null, 'script');
|
$.post(this.action, $(this).serialize(), null, 'script');
|
||||||
|
history_edited = true;
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$(window).bind("popstate", function () {
|
$(window).bind("popstate", function () {
|
||||||
|
if (history_edited) {
|
||||||
$.getScript(location.href);
|
$.getScript(location.href);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
Reference in New Issue