?
Solved

dynamic API URL feed - reading cross domain feed content

Posted on 2012-03-19
1
Medium Priority
?
220 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 1000 total points
ID: 37737608
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

862 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