0

I am trying to make a javascript rss parser. But I am having a problem even connecting to an url and getting the document back.

function myFunction(){
  var xmlDoc;
  var url="http://www.24ur.com/";
  var conn = new XMLHttpRequest();
  conn.onreadystatechange = function() {
    if (conn.readyState == 4) {
      console.log(conn.status);
    }
  };
  conn.open("GET", url, true);
  conn.send();
}

The conn.status in the console.log is 0. I get in the if clause but conn.status returns 0, responseText returns null.Shouldnt this be working??

jcubic
  • 61,973
  • 54
  • 229
  • 402
Borut Flis
  • 15,715
  • 30
  • 92
  • 119
  • 1
    Ajax requests to external domains aren't possible by design. If 24ur.com is not under your control, you'll likely need a server-side proxy to fetch the data – Pekka Mar 09 '13 at 10:48
  • NO it is not under my control, I want to connect to external urls, Is that possible?? – Borut Flis Mar 09 '13 at 10:51
  • It is possible to get rss in json from http://developer.yahoo.com/yql/ even with javascript. – Borut Flis Mar 09 '13 at 15:50

0 Answers0