title: Trouble loading Base64 string to canvas
body: <p>I'm trying to load a Base64 string from my database to a canvas.</p>
  
  <p>I obtained this string from doing the reverse method: I saved it to my database after drawing on a canvas. So, now I want to load it back onto another canvas. I have tried this code which I picked up on the web and somewhere else here on StackOverflow but it doesn't seem to work.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
    $(document).ready(function(){
      var canvas = document.getElementById("loading_canvas");
      var ctx = canvas.getContext("2d");
  
      var image = new Image();
  
      $.post('doodles/load', function(data) {
        image.src = data;
      });
      ctx.drawImage(image, 0, 0);
    });
  &lt;/script&gt;
  </code></pre>
  
  <p>I load in the data from my database with an ajax call.</p>
  
  <p>If I <code>alert()</code> the <code>data</code> var, it displays the encoded Base64 string. So it doesn't really go wrong there.. I just end up with an empty canvas all the time.</p>
  
  <p>Anyone know what I'm doing wrong here? Thanks a lot!</p>