title: Using jQuery's ajax method to retrieve images as a blob
body: <p>I recently asked another (related) question, which lead to this follow up question:
  <a href="https://stackoverflow.com/questions/17643142/submitting-data-instead-of-a-file-for-an-input-form">Submitting data instead of a file for an input form</a></p>
  
  <p>Reading through the jQuery.ajax() documentation (<a href="http://api.jquery.com/jQuery.ajax/" rel="noreferrer">http://api.jquery.com/jQuery.ajax/</a>), it seems the list of accepted dataTypes doesn't include images.</p>
  
  <p>I'm trying to retrieve an image using jQuery.get (or jQuery.ajax if I have to), store this image in a Blob and upload it to another server in a POST request. Currently, it looks like due to the mismatch in datatypes, my images end up being corrupt (size in bytes mismatch, etc.).</p>
  
  <p>The code to perform this is as follows (it is in coffeescript but shouldn't be difficult to parse):</p>
  
  <pre><code>handler = (data,status) -&gt;
    fd = new FormData
    fd.append("file", new Blob([data], { "type" : "image/png" }))
    jQuery.ajax {
      url: target_url,
      data: fd,
      processData: false,
      contentType: "multipart/form-data",
      type: "POST",
      complete: (xhr,status) -&gt;
        console.log xhr.status
        console.log xhr.statusCode
        console.log xhr.responseText
  
    }
  jQuery.get(image_source_url, null, handler)
  </code></pre>
  
  <p>How can I retrieve this image as a blob instead?</p>