SHARE
TWEET

Untitled

a guest Jan 17th, 2018 4 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. window.addEventListener('load' , function(){
  3.  
  4.     var demo = document.getElementById('demo');
  5.    
  6.     function getSource(method, url) {
  7.  
  8.         var xmlhttp = new XMLHttpRequest();
  9.  
  10.         xmlhttp.open(method, url, true);
  11.  
  12.         xmlhttp.onload = function () {
  13.             if (this.status === 200) {
  14.                 var channels = JSON.parse(this.responseText);
  15.  
  16.                
  17.  
  18.                 var output = "";
  19.                 // console.log(channels);
  20.                 for (var i in channels.follows) {
  21.                     console.log(channels.follows[i].channel);
  22.                     output += '<div class="channel"><h4>' + channels.follows[i].channel.display_name + '</h4></div>';
  23.  
  24.                     // console.log(channels.follows[i].channel.display_name);
  25.                 }
  26.  
  27.                 demo.innerHTML = output;
  28.  
  29.             }
  30.         }
  31.  
  32.         xmlhttp.send();
  33.     }
  34.  
  35.     getSource('GET' , 'https://wind-bow.glitch.me/twitch-api/users/chlenososik/follows/channels');
  36. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top