I have an issue that I'm not really sure what to do with as I have no idea what's going on. The following code is used on a site that I want to run as an ajax site. Essentially when you click on one of the main navigation links above (except for the last one) I want it to load that information into the body of the site and then load the new navigation in the top by posting the clickID variable that indicates to the site which navigation to load. The PHP backend is sound.
The problem is this. I'll click on one of the main navigation links and everything will work fine. Then I click on a different one and instead of ignoring the click like the javascript should it allows the browser to go ahead and do the link. It does this in pairs. The odd time the Ajax works great, the even time it seemingly ignores the return false and allows the click to go through.
The reason I have the link there in the first place is because I want to enable non-javascript users to use the site (they just have to deal with full page reloads vs. just swapping out content). Can anyone tell me what's going on?
// AJAX Page Changing
$("#mContainer a:not(:last)").click(function(){
var clickID = $("#mContainer a:not(:last)").index(this);
$("#body").load("/includes/pages/"+$(this).attr("href")+".php");
$("#mContainer").load("/includes/topnav.php",{ajaxtab:clickID});
return false;
});
//
- // AJAX Page Changing
- $("#mContainer a:not(:last)").click(function(){
- var clickID = $("#mContainer a:not(:last)").index(this);
- $("#body").load("/includes/pages/"+$(this).attr("href")+".php");
- $("#mContainer").load("/includes/topnav.php",{ajaxtab:clickID});
- return false;
- });
- //