Lucas Randisi Lucas Randisi - 11 months ago 58
Javascript Question

Retrieving data from an external site

I would like to get some values from an external site that is loaded using js functions. Until now i have tried something like i this but im sure is not the correct way

window.location = "";

x = document.getElementsByClassName('x-grid3-cell-inner x-grid3-col-1')[0].textContent;


Answer Source

window.location will redirect your browser to that location, so the rest of your script is never executed. You probably want to fetch the contents of that url using an ajax request and then do something with that content.

xhttp.onreadystatechange = function() {
  if (this.readyState == 4 && this.status == 200) {
};"GET", "", true);