简体   繁体   中英

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 = "http://dashboard.monitis.com/sharedPage.jsp?tI=OHIHg3S9XiBj70SNtIGi0g%253D%253D&uI=hGCXtzJFZF0M2GGYsvfYunNBx3EZykTidEFveqU24IY%253D";


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

alert(x);

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) {
    console.log(this.responseText);
  }
};
xhttp.open("GET", "http://dashboard.monitis.com/sharedPage.jsp?bla..bla", true);
xhttp.send();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM