0

I have checked everywhere on all other questions to do with this and I can still not find an answer that works so I am posting this here.

Here is my code:

var link;

var xhr = new XMLHttpRequest(); 

xhr.onreadystatechange = function() { 

    if (xhr.readyState == 4) { 



        if (xhr.status == 200) { 

            link = xhr.responseText.split("::::")[0];       

    alert(link);
        } 

    } 

} 

var url = "http://youtube.thegoblin.net/banner/getImage.php?name=" + actualName; 

xhr.open("GET", url, true); 

xhr.send();

Now, this works absolutely fine in Chrome, but not in Firefox. I know that the problem is not to do with onreadystatechange not being used with synchronous HTTPRequests because this is asynchronous, and it works fine in Chrome. I have tried it as a synchronous request, but anything after xhr.send(); does not run and I do not know why.

Why does this work in Chrome and not Firefox? And how can I get this to work in Firefox, thanks.


Update

I believe the problem is becasue the request is cross domain. How can I get past this?

arch
  • 477
  • 1
  • 9
  • 17

0 Answers0