Grow your CSS skills. Land your dream job.

Ajax article posts

  • # January 29, 2013 at 10:00 pm

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

    e.g.

    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

    If you want to load the article without affecting anything other than `

    `, I would suggest to use JSON:

    var startIndex = 0;
    $('button').on("click", function() {
    startIndex++;
    $.ajax({
    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!');
    }
    });
    }).trigger("click");

    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.

    https://github.com/lautr/asfar/issues/1

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

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".