Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // const url = 'https://simple-movie-api-2019.herokuapp.com/movies';
  2. // fetch(url)
  3. //     .then(function(response) {
  4. //         return response.json();
  5. //     })
  6. //     .then(function(myJson) {
  7. //         console.log(JSON.stringify(myJson));
  8. //     });
  9.  
  10.     movieTest = () => {
  11.         let xhttp = new XMLHttpRequest();
  12.         xhttp.onreadystatechange = function() {
  13.             if (this.readyState == 4 && this.status == 200) {
  14.                 let movie = JSON.parse(this.responseText);
  15.                 console.log(movie);
  16.             }
  17.         };
  18.         xhttp.open("GET", "https://simple-movie-api-2019.herokuapp.com/movies/", true);
  19.         xhttp.send();
  20.    
  21.     }
  22.    
  23.     movieTest();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement