Ajax just works once after web loaded!
-
Hi,
I’m trying to make ajax loader post on my own theme.
in loader button, i give the button link like this :
<a href="<?php echo 'page/'.($paged+1); ?>"
so it when it rendered, it will looks like <a href=”page/2″. i’m trying to use ajax to call that, the ajax code is like this :$("#load-more").click(function(event){ event.preventDefault(); var value = $(this).attr("href"); $.ajax({ url: value, success: function(back){ $("#loader-post").remove(); $("#content").append(back); } }); });
after that, in top of header.php i write code to handle that request :
$GLOBALS['paged'] = (get_query_var('paged')) ? get_query_var('paged') : 1; if($GLOBALS['paged'] > 1){ open_post($paged); exit(); }
all the code its run perfectly when i’m trying to load more post after the web loaded (the ajax run perfect to call /paged/2) but after that, the ajax is not working, its just redirecting to /paged/3, the post content is not append, i dont have any idea about this, anybody knows the error ??
thanks,
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Ajax just works once after web loaded!’ is closed to new replies.