(jquery): After Ajax: success, how to limit parsing in pieces and insert piece by piece into the DOM

Posted by Johua on Stack Overflow See other posts from Stack Overflow or by Johua
Published on 2010-03-31T11:26:32Z Indexed on 2010/03/31 11:33 UTC
Read the original article Hit count: 123

Filed under:
|
|

Let's say on ajax success the function: xmlParser(xml) is called and the XML response contains about 1500 xml elements (for example: ...)

Inside it looks like:

function xmlParser(xml){
    var xmlDOM = $(xml);  // dom object containing xml response

    xdom.find("book").each(function(){
        var $node = $(this);
        // parsing all the <book> nodes
    });
}

How can you say: parse only first 20 nodes from the xml response, do something with them. And you have a button,..when clicked parses the next 20 nodes...and so on.

So bassically, is there something like: children(20)....and a function wich will parse the next 20 nodes onClick.

thx

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about limit