如何从网页中获取文本数据
How to get text data from webpage
我正在尝试使用 XMLHttpRequest 从有关机构的网站获取数据,但我收到的不是数据,而是错误页面,请帮助
我的代码:-
var url = '[https://tsecet.nic.in/institute_details.aspx?iCode=JNTH][3]';
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.write( this.responseText);
}
}
xhttp.open("GET", url , true);
xhttp.send();
目标网页地址:-
https://tsecet.nic.in/institute_details.aspx?iCode=JNTH
如果我尝试打开
https://tsecet.nic.in/Default.aspx>>然后点击>>
institute profile >> then click on>>JNTH
然后我就可以在浏览器中获取数据,否则我会被重定向到一个错误页面
请帮帮我...
备注
I am trying to get this data from a different website and a different
domain This website is scripted in aspx
您尝试 运行 的 AJAX 请求无法做到这一点,因为页面具有 X-XSS-Protection: 1
header、blocking such requests。看起来他们只允许在主页设置的 "frame" 内启动内部 URI。不幸的是,我不能确定。简而言之,您将需要另一种方法。
我正在尝试使用 XMLHttpRequest 从有关机构的网站获取数据,但我收到的不是数据,而是错误页面,请帮助
我的代码:-
var url = '[https://tsecet.nic.in/institute_details.aspx?iCode=JNTH][3]';
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.write( this.responseText);
}
}
xhttp.open("GET", url , true);
xhttp.send();
目标网页地址:- https://tsecet.nic.in/institute_details.aspx?iCode=JNTH
如果我尝试打开
https://tsecet.nic.in/Default.aspx>>然后点击>>
institute profile >> then click on>>JNTH
然后我就可以在浏览器中获取数据,否则我会被重定向到一个错误页面
请帮帮我...
备注
I am trying to get this data from a different website and a different domain This website is scripted in aspx
您尝试 运行 的 AJAX 请求无法做到这一点,因为页面具有 X-XSS-Protection: 1
header、blocking such requests。看起来他们只允许在主页设置的 "frame" 内启动内部 URI。不幸的是,我不能确定。简而言之,您将需要另一种方法。