2

Not sure why this isn't working. Can someone please help? I know the API feed is working but for some reason it's not pulling in the data. Thanks!!!

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>JSON Sample</title>
</head>
<body>
<div id="placeholder"></div>
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script>

 $.getJSON("http://api.gaycities.com/v6/events?metro_id=1&popularrange=2013-02-30",     function(data) {
    var jsondata=json;
    var output="<ul>";
    for (var i in jsondata.events) {
        output+="<li>" + jsondata.events[i].group + " " + jsondata.events[i].name + "--" +        jsondata.events[i].metro_id+"</li>";
    }

    output+="</ul>";
    document.getElementById("placeholder").innerHTML=output;
  });
   </script>
 </body>
  </html>

1 Answer 1

1

The issue is cross origin resource sharing limitations, or CORS for short. You can't fetch data from another domain without using either

A) JSONP, or

B) server side fetching.

Because there is no callback to that` URL address, you'll need to use a server side language to fetch the data, or identify if you can be added to the access control allow origin rule set.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.