簡體   English   中英

從外部站點檢索數據

[英]Retrieving data from an external site

我想從使用js函數加載的外部站點獲取一些值。 直到現在,我已經嘗試過類似的方法,但是我確定這不是正確的方法

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會將您的瀏覽器重定向到該位置,因此腳本的其余部分將永遠不會執行。 您可能想使用ajax請求來獲取該URL的內容,然后對該內容進行處理。

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();

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM