Jaxel
Well-known member
I am trying to paginate one of my pages... and with this pagination, I want things loaded with AJAX to prevent refreshes. I have the content I want to reload as follows:
Then my javascript is pretty simple:
As you can see, all the code does is find the links in the pageNav, prevents their default activation, and replaces the entire contents of the "eventResults" div; which includes the page navigation node as well.
The problem I am having with this is, after the page navigation node is replaced, subsequent javascript calls for page navigation no longer function. How do I get the javascript to work on the new html?
You can see this issue here: Final Round XVI | 8WAYRUN.com
Code:
<xen:require js="js/8wayrun/EWRtorneo_ajax.js" />
<div class="eventResults">
<xen:pagenav link="rankings/event" linkdata="{$event}" page="{$start}" perpage="{$stop}" total="{$count}" />
<--- MY CONTENT --->
</div>
Then my javascript is pretty simple:
Code:
XenForo.register('.eventResults .PageNav a', 'XenForo.ResultSelection');
XenForo.ResultSelection = function($link)
{
$link.click(function(e)
{
e.preventDefault();
XenForo.ajax(
$link.attr('href'),
{},
function(ajaxData, textStatus)
{
if (XenForo.hasTemplateHtml(ajaxData))
{
new XenForo.ExtLoader(ajaxData, function()
{
$(ajaxData.templateHtml).xfInsert('replaceAll', '.eventResults', 'xfShow');
});
}
}
);
});
}
As you can see, all the code does is find the links in the pageNav, prevents their default activation, and replaces the entire contents of the "eventResults" div; which includes the page navigation node as well.
The problem I am having with this is, after the page navigation node is replaced, subsequent javascript calls for page navigation no longer function. How do I get the javascript to work on the new html?
You can see this issue here: Final Round XVI | 8WAYRUN.com