The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "Implementing an SVG Icon System" Nov 30 - 6:00 PM Eastern

Ajax article posts

  • # January 29, 2013 at 10:00 pm

    What if I wrapped the content I need to load within a div `.ajax`


    some content

    some content

    some content

    From there, I just call to `.load()` the children of .ajax or perhaps .ajax altogether on a click event.

    I’m not sure if this will work. I’ve never worked with Ajax from scratch before.

    # January 30, 2013 at 7:43 am

    This reply has been reported for inappropriate content.

    If you want to load the article without affecting anything other than <div class='ajax'>, I would suggest to use JSON:

    var startIndex = 0;
    $('button').on("click", function() {
    url: 'json-feed-url?start-index=' + (startIndex*3),
    type: 'get',
    dataType: 'jsonp',
    success: function(data) {
    var skeleton = "";

    // proccess...

    $('.ajax').append(skeleton); // append the processed data

    error: function() {
    alert('Error loading feed!');

    There’s should be some JSON index parameters that can be used to load the data gradually.

    It’s just, I don’t know about the JSON in WordPress (or Kirby?). I used to handle Blogger JSON.

    Edit: Sorry, so it’s already working. Just ignore this answer.

    # January 30, 2013 at 10:02 am

    @Hompimpa Correct, Ajax is technically working. However, the functionality is not correct. Above I stated that when you go to the homepage (/dev), click on one of the arrows and then click on About or Find at the top, those pages will load into that section where my articles are.

    # January 30, 2013 at 10:29 am

    I believe the problem is that Ajax is targeting ALL anchor links instead of my pagination links.

    # January 30, 2013 at 12:39 pm

    I was correct.

Viewing 5 posts - 16 through 20 (of 20 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed