Solved

dynamic API URL feed - reading cross domain feed content

Posted on 2012-03-19
1
209 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
Comment Utility
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now