开发者

Parsing XML with JQUERY - Sorting into two arrays

I'm trying to parse a little bit of XML with JQuery, I'd like to find the entries with开发者_开发百科 updated status of 0 and add them to one array and do the same for updated statuses of 1 to a different array.

XML:

<entries>
   <upd>
      <updated>0</updated>
      <name>Adams</name>
   </upd>

   <upd>
      <updated>1</updated>
      <name>Dempsey</name>
   </upd>
</entries>

All I have as of right now is:

        $(xml).find("upd").each(function(){

        });

My main problem is distinguishing between an updated status of 1 or 0.


$(xml).find("upd").each(function() {
    var updated = $(this).find("updated").text();
    console.log(updated); // 0 then 1
});

Continue down the same path. Example

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜