I use the following jquery for hijaxing. It's quite neat as it assumes the majority of links "want" hijaxing but lets those that don't "opt out" by having the class "nohijax". Why does it occasionally fail?
$("#content a:not(.nohijax), #footer a:not(.nohijax)").live("click", function () {
$.get($(this).attr("href"), function (response) {
$("#content").replaceWith($("#content", response));
});
return false;
});
It works 100% in Chrome, 100% in IE9 on my machine, but fails infrequently in IE on other machines. The failures are not consistent. Even on a "failing" machine the hijaxing works most of the time but suddenly a clicked link will appear to "do nothing" because the old content is not replaced with the new. "Open in new tab" always works, showing that the new content is indeed sent.
I've tried to research the problem here. One has to be careful using .not() with .live() but I believe I have that right. Also the replaced element (here, a div with id="content") must not be a direct child of the body element. It isn't (there's another div in between).
If there's no obvious howler, how can I trace what's going on? (I am new to javascript and browser development). Thank you.