title: To build an image URL using XMLHttpRequest for TMDB?
body: <p>How can I build a URL and then get a particular poster of movie using javascript. I went through documentation of TMDB here -> <a href="https://developers.themoviedb.org/3/movies/get-movie-images" rel="nofollow noreferrer">https://developers.themoviedb.org/3/movies/get-movie-images</a> and  <a href="https://developers.themoviedb.org/3/configuration/get-api-configuration" rel="nofollow noreferrer">https://developers.themoviedb.org/3/configuration/get-api-configuration</a> but as I am new to API's the documentation is so confusing. Basically I am trying to replicate this -><a href="https://www.smashingmagazine.com/2012/02/beginners-guide-jquery-based-json-api-clients/" rel="nofollow noreferrer">https://www.smashingmagazine.com/2012/02/beginners-guide-jquery-based-json-api-clients/</a> with pure Javascript. </p>
  
  <pre><code>&lt;body&gt;
  &lt;img id="movie-poster" src=""&gt;
  
  &lt;input id="movie_title" type="text" name="Enter Movie title" value="Please Enter"&gt;
  &lt;input type="submit" name="Submit"&gt;
  
  &lt;script type="text/javascript"&gt;
      var getposter = function () {
  
          var film = document.getElementById("movie_title").value;
  
          if(film == ''){
              document.write("&lt;h2&gt; We haven't forgotten  to validate the form! Please enter something. &lt;/h2&gt;")
          } else {
  
              document.write("Loading your poster &lt;br&gt;");
  
              var data = "{}";
  
              var xhr = new XMLHttpRequest();
              xhr.withCredentials = true;
  
              xhr.addEventListener("movie-poster", function () {
                   if (this.readyState === this.DONE) {
                        console.log(this.responseText);
                       }
              });
  
              xhr.open("GET", "https://api.themoviedb.org/3/movie/%7Bmovie_id%7D/images?language=en-US&amp;api_key=%3C%3Capi_key%3E%3E");
  
              xhr.send(data);
          }
      }
  &lt;/script&gt;
  </code></pre>