Solved

dynamic API URL feed - reading cross domain feed content

Posted on 2012-03-19
1
211 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
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…

776 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