TwitchTV getJSON help


Can’t seem to get JSON data to return. Copying and pasting the url into a new window returns the exact data I want. What am I missing?

 $(document).ready(function() {
  var streamUrl = "";
  var users = [

  users.forEach(function(user) {
    $.getJSON(streamUrl + user, function(data) {


Check your browser’s debug console for errors. (Ctrl+Shift+J on Windows/Linux, Command+Option+J on Mac OS).

This is the error you are getting:

XMLHttpRequest cannot load Redirect from ‘’ to ‘’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘’ is therefore not allowed access.

To fix this error, change your streamUrl to use the redirect URL instead:

  var streamUrl = "";

Or, you can leave it as is and use JSONP instead (but not as good of an option here IMO):

    $.getJSON(streamUrl + user + `?callback=?`, function(data) {


Works great. Thanks!