XML Parsing using Jquery Mobile

前端 未结 1 1201
予麋鹿
予麋鹿 2021-01-15 21:26

I have an XML of following format. I want to extract the \'title\' and \'submenu\' tags and create a menu bar structure out of it as in the image below.

<         


        
相关标签:
1条回答
  • 2021-01-15 22:16

    You have to use jquery's parseXML function,

      var xml = "<rss version='2.0'><channel><title>RSS Title</title></channel></rss>",
      xmlDoc = $.parseXML( xml ),
      $xml = $( xmlDoc ),
      $title = $xml.find( "title" );
    
      alert($title.text());
    

    Refer https://api.jquery.com/jQuery.parseXML/

    0 讨论(0)
提交回复
热议问题