Pandu

Pandu

  • NA
  • 18
  • 19.7k

Xmlhttprequest object in Java script.

Mar 22 2014 5:13 PM
<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)