I have an HTML button that captures the canvas image using toDataURL(). I want to pass the data to a form element, which will send via formmail. I can get all other variables passed via hidden form elements, but the canvas data won't take. It must not be formatted properly to send. What is the correct syntax to send, if possible?
In JavaScript
imgData = theCanvas.toDataURL(); document.getElementById('theImageData').value=imgData; In HTML
<input type="hidden" name="theImageData" id="theImageData" value="">
console.log(imgData)to see what data you put inimgDatavariable.imgData.valueshould not work. That's very strange to me. To answer your second question: you should use this approach when you have data URL stackoverflow.com/a/3379955/99256