Aka
Aka

Reputation: 13

How to get text data from webpage

I am trying to get data form a website about institution using XMLHttpRequest but rather than data I am getting error page please help

My code:-

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

Target Web Page Address:- https://tsecet.nic.in/institute_details.aspx?iCode=JNTH

If I try to open
https://tsecet.nic.in/Default.aspx>>then click on >> institute profile >> then click on>>JNTH Then I am able to get data in browser Else I am redirected to an error page

Please help me...

Note

I am trying to get this data from a different website and a different domain This website is scripted in aspx

Upvotes: 0

Views: 51

Answers (1)

Dimitris Damilos
Dimitris Damilos

Reputation: 2438

The AJAX request you're trying to run can't do that, as the pages have the X-XSS-Protection: 1 header, blocking such requests. It looks as if they allow the internals URIs to launch only within a "frame" set by the homepage. Unfortunately, I can't tell for sure. In short, you are going to need another approach.

Upvotes: 1

Related Questions