[jQuery] Help with livequery logic

[jQuery] Help with livequery logic

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
I am trying livequery to solve this problem. I have a youth mentoring
site that has profiles. They want to filter the profiles. I have a div
that I use to stuff the filtered data into (#FilteredProfiles). The
filtered data has pagination links at the bottom that I do not have
control over. I want to bind a function to those links that does a post
and gets new data. The problem is that the new data that is returned
has new pagination links that need the function rebound. If I do not
rebind the pagination links then the ones that are created by the cms
are used and the browser loads the wrong page.
I have used livequery in this logic with success so I know it is
working. The problem lies in the area marked "This is the problem
area". When that code executes the post does it's thing but the new
links inside the new data do not get the function rebound. If I remove
that section of logic then the link that I click on changes text to
"Clicked!" like it is supposed to.
Does anybody have any suggestions?
Thanks!
**************************************************
<small>$(document).ready(function(){
    getData();
    $("#FilterSubmit").livequery('click', function(){
        getData();
    });//End of the filterSubmit actions
});//end of ready function
function getData(){
var
$pagename=<a class="moz-txt-link-rfc2396E" href="http://www.youthmentoring.net/includes/publicProfiles">"http://www.youthmentoring.net/includes/publicProfiles"</a>+$("#gender
option:selected").val()+$("#location option:selected").val();
$("#FilteredProfiles").html('<img
src=<a class="moz-txt-link-rfc2396E" href="http://www.youthmentoring.net/images/text-fetchingdata.gif">"http://www.youthmentoring.net/images/text-fetching data.gif"</a>
alt="Fetching data">');
$("#FilteredProfiles").load($pagename, function(data){
    $("#FilteredProfiles").html(data);
    $('#Pagination > a').livequery('click', function() {
        var pattern=/P[0-9]([0-9]*)?/;
        var $urlAppend;
        if ($(this).attr("href").match(/P[0-9]([0-9]*)?/)){
            $urlAppend =
$(this).attr("href").match(/P[0-9]([0-9]*)?/)[0];
        }else{
            $urlAppend = "P0";
        }
        //Display getting data graphic
        //This is the problem area
        $("#FilteredProfiles").html('<img
src=<a class="moz-txt-link-rfc2396E" href="http://www.youthmentoring.net/images/text-fetchingdata.gif">"http://www.youthmentoring.net/images/text-fetching data.gif"</a>
alt="Fetching data">');
        var
$url=<a class="moz-txt-link-rfc2396E" href="http://www.youthmentoring.net/includes/publicProfiles">"http://www.youthmentoring.net/includes/publicProfiles"</a>+$("#gender
option:selected").val()+$("#location
option:selected").val()+"/"+$urlAppend ;
        $("#FilteredProfiles").post($url, function(data){
            $("#FilteredProfiles").html(data);
        });
        //End of the problem area
        $(this).text('Clicked').blur();
        return false;
    });
});//End of load
}//End of getData function</small>
**************************************************************
</body>
</html>



































































    • Topic Participants

    • eric