Skip to content

Instantly share code, notes, and snippets.

@sudheesh001
Created May 28, 2014 12:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sudheesh001/f9628b51810dbf4aebee to your computer and use it in GitHub Desktop.
Save sudheesh001/f9628b51810dbf4aebee to your computer and use it in GitHub Desktop.
Vibe - Mozilla India
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Event Portal | Mozilla Vibe</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
var dateToday = new Date();
var dateString = dateToday.getFullYear() + "-" + (dateToday.getMonth()+1) + "-" + dateToday.getDate()
var repsUri = 'https://reps.mozilla.org/api/v1/event/?offset=0&limit=0&start__gte=' + dateString + '&query=india';
var jsonmarkers;
$.getJSON(repsUri, function(json){
jsonmarkers = json;
console.log(jsonmarkers);
});
</script>
</body>
</html>
@sudheesh001
Copy link
Author

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://www.mozilla.org/. This can be fixed by moving the resource to the same domain or enabling CORS.

@debloper
Copy link

It's either:

  var jsonmarkers = json;
  console.log(jsonmarkers);

or,

  console.log(json);

although, that doesn't seem to be the blocker here. Check the devtools' network log if you're getting the response or not. Have you tried preflighting the AJAX request?

@debloper
Copy link

Expectedly, the CORS is the culprit.
File a bug to allow *mozillaindia.org among the accepted origins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment