Advertisement
Guest User

Untitled

a guest
Apr 26th, 2015
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2.  
  3. <html>
  4.  
  5.  
  6.     <head>
  7.  
  8.         <meta charset="utf-8">
  9.         <title>Title</title>
  10.  
  11.     </head>
  12.  
  13.  
  14.  
  15.     <body>
  16.  
  17.         <script>
  18.  
  19.  
  20.             var gists = [];
  21.  
  22.             function getGists(gists)
  23.             {
  24.    
  25.                 var request = new XMLHttpRequest();
  26.            
  27.                 if(!request)
  28.                 {
  29.                     throw 'Unable to create HttpRequest.';
  30.                 }
  31.  
  32.                 var url = 'https://api.github.com/gists/public';
  33.  
  34.                
  35.  
  36.                 request.onreadystatechange = function()
  37.                 {
  38.  
  39.                     if(this.readyState == 4)
  40.                     {
  41.  
  42.                        
  43.                         console.log(this.responseText);
  44.                         gists = JSON.parse(this.reponseText); //missing ;?
  45.                        
  46.                        
  47.  
  48.                         //console.log(this.reponseText);
  49.  
  50.                        
  51.  
  52.                     }
  53.                 };
  54.  
  55.                 request.open('GET', url);
  56.  
  57.                 request.send();
  58.  
  59.             }
  60.  
  61.             getGists(gists);
  62.  
  63.             //console.log(gists[0].user);  
  64.  
  65.     </script>
  66.  
  67.     </body>
  68. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement