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! ************************************************** $(document).ready(function(){ getData(); $("#FilterSubmit").livequery('click', function(){ getData(); });//End of the filterSubmit actions });//end of ready function function getData(){ var $pagename="http://www.youthmentoring.net/includes/publicProfiles"+$("#gender option:selected").val()+$("#location option:selected").val(); $("#FilteredProfiles").html('<img src="http://www.youthmentoring.net/images/text-fetching data.gif" 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="http://www.youthmentoring.net/images/text-fetching data.gif" alt="Fetching data">'); var $url="http://www.youthmentoring.net/includes/publicProfiles"+$("#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 **************************************************************