Reputation: 77
scheme:user draws in canvas, canvas converted to image (png or jpeg), converted file is saved in specific dir on server, after drawing canvas user clicks button, all i could do is:
function to_image(){
var canvas = document.getElementById("canvas");
var data = canvas.toDataURL('image/png');}
how i can perform this task? (is there any way to do it without AJAX or not?)
Upvotes: 2
Views: 483
Reputation: 964
You'll have to submit it to the server using a form and/or ajax. JavaScript is run at clientside, so its not able to interfere with the server directly.
Edit: You could maybe find something usefull here, if you need more info on how to do this: Uploading 'canvas' image data to the server
Upvotes: 1