用户发布请求以传递大数据。您可以使用 jQuery post 方法
$.post('myPHPfile.php', { imageData: imgData }, function(data) {
// completed
});
或创建并发布表单:
function uploadPic() {
var imgData = document.getElementById("myCanvas").toDataURL();
var form = document.createElement('form');
form.method = "POST";
form.action = "myPHPfile.php";
var hidden = document.createElement('input');
hidden.type = 'hidden';
hidden.name = 'imageData';
hidden.value = imgData;
form.appendChild(hidden);
document.body.appendChild(form);
form.submit();
}