I'm working with html2canvas and I have the next function
hml2canvas($('body'), {
onrendered: function(canvas) {
data = canvas.toDataURL('image/jpeg');
}
});
Now, I want to return the data value, so I tried this
html2canvas($('body'), {
onrendered: (this, imgBase64)
});
var data;
function imgBase64(canvas) {
data = canvas.toDataURL('image/jpeg');
}
console.log(data);
but when I see the console I get "undefined". If I put console.log(data);
inside the imgBase64
function I get the base64 of the image, but I need the data
out of that function to make another work with it.
Any ideas?
Thanks.