Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<meta charset=utf-8 />
<title>Test Page</title>
<style>
  body {
    font-family: sans-serif;
  }
</style>
</head>
<body>
</body>
</html>
 
jQuery(function($) {
  
  var xml =
      '<?xml version="1.0" encoding="UTF-8" ?>' +
      '<ajax-response>' +
          '<response>' +
              '<item>' +
                  '<name><![CDATA[ok]]></name>' +
                  '<value><![CDATA[true]]></value>' +
              '</item>' +
              '<item>' +
                  '<name><![CDATA[menuDiv]]></name>' +
                  '<value><![CDATA[Some HTML value]]></value>' +
              '</item>' +
          '</response>' +
      '</ajax-response>';
  
  var xmlDoc = $.parseXML( xml ),
      $xml = $( xmlDoc ),
      menuDivText =
        $xml.find("item name:contains(menuDiv)").next().text();
  display("menuDiv's text is: " + menuDivText);
  
  function display(msg) {
    $("<p>").html(msg).appendTo(document.body);
  }
});
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers