title: Imgur API return "undefined"
body: <p>I've the following js code to upload image to imgur using Auth.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      window.ondragover = function(e) {e.preventDefault()}
      window.ondrop = function(e) {e.preventDefault(); upload(e.dataTransfer.files[0]); }
      function upload(file) {
  
  
          if (!file || !file.type.match(/image.*/)) return;
  
  
          document.body.className = "uploading";
  
  
          var fd = new FormData();
          fd.append("image", file);
          var xhr = new XMLHttpRequest();
          xhr.open("POST", "https://api.imgur.com/3/image.json");
          xhr.onload = function() {
              var code = '[img]' + JSON.parse(xhr.responseText).data.link + '[/img]';
              var editor = eval('opener.' + 'clickableEditor');
              editor.performInsert(code);
              javascript:window.close()
          }
  
          xhr.setRequestHeader('Authorization', '39-letter-client-secret-code');
  
          xhr.send(fd);
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>It doesn't uploads image to the imgur, but it returns data "undefined". Can you please mention me if I'm missing something here?</p>