User Tools

Site Tools


jsajax:parsing_xml_using_ajax

XML :

<speakers>
  <speaker>
    <name>Jean-Michel</name>
    <...>...</...>
  </speaker>
  <speaker>...</speaker>
  ...
</speakers>
var requete = new XMLHttpRequest();
requete.open('GET', 'data.xml');
requete.onreadystatechange =  function() {
  if ( (requete.readyState === 4) && (requete.status === 200) ) {
    console.log(requete.responseXML.getElementsByTagName('name')[1];
  }
}
requete.send();
jsajax/parsing_xml_using_ajax.txt · Last modified: 2016/03/17 12:10 by leo