0

I have multiple pages that I need to load dynamically whenever a load more button is click

http://example.com/?page_id=1208&paged=1
http://example.com/?page_id=1208&paged=2
http://example.com/?page_id=1208&paged=3
http://example.com/?page_id=1208&paged=4

By default http://example.com/?page_id=1208&paged=1 will load up, so if I click on the load more button I need to append the new content into the page but instead of loading from page 1 I will need to load from page 2,3 and 4 every time I click on the load more button.

How do I make a ajax call that will work with multiple urls?

I used jQuery ajax .load but the problem is the nextLink variable will not be updated since it is already loaded in the js file.

var url = "http://example.com/?page_id=1208&paged="
var pageNum = 1;
var nextLink =url+pageNum;

 $('.content-'+ pageNum).load(nextLink + ' .each-block',
    function() {
        pageNum++;
    }
);
2
  • what do you mean? you need to provide more explanation Commented May 3, 2015 at 22:15
  • @erkaner just updated, thanks for the help Commented May 3, 2015 at 22:22

1 Answer 1

1

class eqals content1

 $('.content-'+ pageNum).load(nextLink, function() {
        pageNum++;
    }
);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.