我正在尝试使用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 >>然后单击>> JNTH
然后我可以在浏览器中获取数据,否则我将重定向到错误页面
请帮助我...
注意
我正在尝试从其他网站和其他网站获取此数据 域此网站以aspx编写脚本
答案 0 :(得分:2)
您尝试运行的AJAX请求无法执行此操作,因为页面具有X-XSS-Protection: 1
标头blocking such requests。似乎它们允许内部URI仅在主页设置的“框架”内启动。不幸的是,我不能确定。简而言之,您将需要另一种方法。