title: How to return a bitmap to a browser WebApi
body: <p>I am making a request to the server "WebApi" using JavaScript from an already loaded document on the client side.</p>
  
  <p>When the server receives the request it builds a bitmap on the fly and returns it back to the client as a .png.</p>
  
  <p>When i read the response on the client side all I get back from the data portion of the .ajax request is an empty string.</p>
  
  <p>How can I read and image requested from a server using WebApi and then set the src attribute of a image on the client side with the new image received from the server?</p>
  
  <p>--WebApi</p>
  
  <pre><code>public HttpResponseMessage Get(int id)
      {
          ElevationResponse elev = ElevationHelper.GetElevation(id);
  
          Bitmap canvas = ShopDrawing.Elevation.Elevation.GetShopDrawing(elev, true);
  
          var ms = new MemoryStream();
          canvas.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
  
          HttpResponseMessage r = Request.CreateResponse();
          r.Content = new StreamContent(ms);
          r.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("image/png");
          return r;
      }
  </code></pre>
  
  <p>--Client</p>
  
  <pre><code>  $.ajax(
           {
               async: true,
               url: '/api/drawings?id=' + this.id,
               type: 'GET',
               contentType: "application/json",
               success: function (d, status) {
                   debugger
  
               }
           });
  </code></pre>