1
Answer

Xmlhttprequest object in Java script.

Pandu

Pandu

10y
767
1
<HTML>
<HEAD>
<TITLE>Trying to get top 10 you tube videos</TITLE>
<SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT">
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://www.google.com/", false);
xhr.send();

console.log(xhr.status);                      //// 200
console.log(xhr.statusText);               //// Ok
</SCRIPT>
</HEAD>
<BODY>


</BODY>
</HTML>
 
 
What am I doing wrong in this? When I run this on browser I am not getting output as 200 and ok.
Answers (1)