Answers for "Some simple code to do something with data from an XML document fetched over the network"

0

Some simple code to do something with data from an XML document fetched over the network

function processData(data) {
  // taking care of data
}

function handler() {
  if(this.status == 200 &&
    this.responseXML != null &&
    this.responseXML.getElementById('test').textContent) {
    // success!
    processData(this.responseXML.getElementById('test').textContent);
  } else {
    // something went wrong
    …
  }
}

var client = new XMLHttpRequest();
client.onload = handler;
client.open("GET", "unicorn.xml");
client.send();
Posted by: Guest on September-22-2021

Code answers related to "Some simple code to do something with data from an XML document fetched over the network"

Code answers related to "Javascript"

Browse Popular Code Answers by Language