开发者

Parsing XML with JQUERY - Sorting into two arrays

开发者 https://www.devze.com 2023-04-12 10:29 出处:网络
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 dif

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

精彩评论

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

关注公众号