[Vuejs]-Read CSV File From Sharepoint Using XMLHttpRequest

0👍

I am not sure I understood your question completely, but here is what I think might be the answer:

using XMLHttpRequest():

var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
       // Typical action to be performed when the document is ready:
       document.getElementById("demo").innerHTML = xhttp.responseText;

       // in here you basically manipulate your dom with fetched data or call on functions.
    }
};
xhttp.open("GET", "yourApiUrl", true);
xhttp.send();

JSON:

let url = 'https://example.com';

fetch(url)
.then(res => res.text())
.then(out =>
  console.log('My data here', out))
.catch(err => throw err);

JSON is Like XML Because

  • Both JSON and XML are "self describing" (human readable)
  • Both JSON and XML are hierarchical (values within values)
  • Both JSON and XML can be parsed and used by lots of programming languages
  • Both JSON and XML can be fetched with an XMLHttpRequest

JSON is Unlike XML Because

  • JSON doesn’t use end tag
  • JSON is shorter
  • JSON is quicker to read and write
  • JSON can use arrays

The biggest difference is:

XML has to be parsed with an XML parser. JSON can be parsed by a standard JavaScript function.

Why JSON is Better Than XML

XML is much more difficult to parse than JSON.
JSON is parsed into a ready-to-use JavaScript object.

Source: W3School

Leave a comment