I have a script that writes text on a canvas. It works fine. The problem is if I make an Ajax call to first get the string and then secondly write the string to the canvas, JavaScript seems to ignore the order that I want things done and write the string before the Ajax call; the result is the script prints to the canvas 'undefined'.
psuedocode:
//var str = ~some_ajax_call... <---If I use this, the output is undefined.
var str = "hello world";
context.fillStyle = '#00f';
context.font = 'italic 30px sans-serif';
context.textBaseline = 'top';
context.fillText (str, 0, 0);