um, you are passing in .subnav as the root in secondryClickHandler, but are 
still prefixing your search term with .subnav

if you are using root as context, then you don't need ('.subnav a',root) but 
only ('a',root) 

----- Original Message ----
From: Tane Piper <[EMAIL PROTECTED]>
To: jquery-en@googlegroups.com
Sent: Tuesday, April 17, 2007 3:55:13 PM
Subject: [jQuery] More AJAX and link issues


Hey again folks,

Since my last email, I had decided to go with a small change in design.
In my application, I have 3 areas:

.primary
.subnav
.content

.primary is the top of site navigation.  This is for entries such as
Home, News, Events, Login/Register.

With my code below, what I want it to do is load the content into the
.subnav area (which it does on first load of the page) and then
reparse the document for .subnav links (which it's not doing).  When a
.subnav link is clicked, this should load into the content area (which
again, it does on the first load of the page) and reparse the links.
These links then should load content back into the .subnav area
(again, first load) and reparse.

So overall, I know my functions are working, as they load on $().ready
but I just cannot get them to execute again when I load content into a
div via AJAX.

You can check a demo and source at http://66.160.135.85/

Tane

function primaryClickHandler(root) {
    $('.primarynav a',root).click(function(){
        $this = $(this);
        $('.subnav').load(this.href,function(){
            secondryClickHandler($('.subnav'));
        });
        return false;
    });
};

function secondryClickHandler(root) {
    $('.subnav a',root).click(function(){
        $this = $(this);
        $('.content').load(this.href,function(){
            contentClickHandler($('.content'));
        });
        return false;
    });
};

function contentClickHandler(root) {
    $('.content a',root).click(function(){
        $this = $(this);
        $('.subnav').load(this.href,function(){
            secondryClickHandler($('.subnav'));
        });
        return false;
    });
}

$('document').ready(function() {
    primaryClickHandler(document);
    secondryClickHandler(document);
    contentClickHandler(document);
});



Reply via email to