Title: Ajax Issue
Last modified: August 22, 2016

---

# Ajax Issue

 *  Resolved [jarth3000](https://wordpress.org/support/users/jarth3000/)
 * (@jarth3000)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/ajax-issue-1/)
 * Hello!
 * I wanted to thank you again for helping with my previous issue, but now, another
   has arisen.
 * The posts that Ajax Load More are loading have a link in them in which when clicked,
   it pulls up a div and loads content via ajax. This works for my initial posts,
   but not for the posts that are pulled via Ajax Load More. I suspect it has to
   do with the jquery calls and loads prior to Ajax Load More bringing in more posts.
 * I’m assuming it’ll be a simple fix of adding something to the jQuery file of 
   Ajax Load More, but I figured I’d ask the creator for assistance so I don’t muck
   it up.
 * Below is the ajax call that when a link is click, it pulls the additional info.
 *     ```
       $.ajaxSetup({cache:false});
               $(".more-results").click(function(){
                    var post_link = $(this).attr("href");
        	    $('#results-overview').fadeIn('slow');
                   $("#results-overview").load(post_link);
       	    $(document).click(function(event) {
           		if(!$(event.target).closest('#results-post').length) {
               		if($('#results-post').is(":visible")) {
                   			$('#results-overview').fadeOut('slow');
               		}
           		}
       		})
       	    $(document).ajaxComplete(function() {
   
         		$('#scrollbox3').enscroll({
           			showOnHover: true,
           			verticalTrackClass: 'track3',
           			verticalHandleClass: 'handle3'
       			});
       	$("#vote").click(function(){
           		$(this).fadeOut('slow');
       		$('#vote-ratings').fadeIn('slow');
       	});
   
       		});
   
               return false;
               });
       ```
   
 * As I’ve said, the code works on the initial items pulled by my main loop, but
   NOT the ones pulled by Ajax Load More.
 * Thoughts?
 * Thanks!
 * Josh
 * [https://wordpress.org/plugins/ajax-load-more/](https://wordpress.org/plugins/ajax-load-more/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * (@dcooney)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/ajax-issue-1/#post-5608789)
 * Hi,
    you likely need to move your click events to use jQuery on(). THe issue 
   is you have click events on elements that are not yet created.
 * Like so,
 *     ```
       $(document).on('click', '.more-results', function(){
       });
       ```
   
 *     ```
       $(document).on('click', '#vote', function(){
          $(this).fadeOut('slow');
          $('#vote-ratings').fadeIn('slow');
       });
       ```
   
 * [http://api.jquery.com/on/](http://api.jquery.com/on/)

Viewing 1 replies (of 1 total)

The topic ‘Ajax Issue’ is closed to new replies.

 * ![](https://ps.w.org/ajax-load-more/assets/icon-256x256.png?rev=2944639)
 * [Ajax Load More – Infinite Scroll, Load More, & Lazy Load](https://wordpress.org/plugins/ajax-load-more/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ajax-load-more/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ajax-load-more/)
 * [Active Topics](https://wordpress.org/support/plugin/ajax-load-more/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ajax-load-more/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ajax-load-more/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * Last activity: [11 years, 5 months ago](https://wordpress.org/support/topic/ajax-issue-1/#post-5608789)
 * Status: resolved