Submit Canvas Data in an HTML Form
As mentioned in this answer, you should send the canvas to your server separately, then put your form submit function inside of the done callback.
var dataURL = canvas.toDataURL();$(function() { $(form).submit(function(e) { e.preventDefault(); $.ajax({ type: "POST", url: "script.php", data: { imgBase64: dataURL } }).done(function(o) { console.log('saved image'); $.post(url, form.serialize(), function(data) { console.log('saved form') }; });