Solved

dynamic API URL feed - reading cross domain feed content

Posted on 2012-03-19
1
213 Views
Last Modified: 2012-07-16
Hi,

I am trying to read a cross-domain feed URL using the following code,

---------------------------------------------------------------------------------------------
<script type="text/javascript">
            function processStateChange(){
                    statusDiv = document.getElementById("feed");
                    if (req.readyState == 0){ statusDiv.innerHTML = "UNINITIALIZED"; }
                    if (req.readyState == 1){ statusDiv.innerHTML = "LOADING"; }
                    if (req.readyState == 2){ statusDiv.innerHTML = "LOADED"; }
                    if (req.readyState == 3){ statusDiv.innerHTML = "INTERACTIVE"; }
                    if (req.readyState == 4){
                      statusDiv.innerHTML = "COMPLETE";
                      statusDiv.innerHTML = req.responseText;
                      }
            }
            function getXMLObject() //XML OBJECT
            {
                  try
                  {
                        xmlHttp=new XMLHttpRequest();
                  }
                  catch (e)
                  {
                        try
                        {
                              xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
                        }
                        catch (e)
                        {
                              try
                              {
                                    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
                              }
                                    catch (e)
                                    {
                                          return false;
                                    }
                        }
                  }
                  return xmlHttp;
            }            
$(document).ready(function() {
            req = new getXMLObject();
            if (req) {
                req.onreadystatechange = processStateChange;
                req.open("GET", "https://aaamusic.com/API?format=XML&partner=aaadotcom&key=WpMzTcGV&query=featuredalbums", true);
                req.send();
            }
  });
</script>  
---------------------------------------------------------------------------------------------

The above code reads the feed correctly in IE (Msxml2.XMLHTTP), but FF and other browsers does not pull up the feed data.

Can any one of you help me in fixing this.

Thanks,
-P-
0
Comment
Question by:Perumal_RM
1 Comment
 
LVL 11

Accepted Solution

by:
Amar Bardoliwala earned 500 total points
ID: 37737608
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question