Open acrm opened 6 years ago
For saving our drawings we should transport clicks collection to server and store them in some fie.
Save
button click handler code that serialize clicks collection to JSON and send it via XmlHttpRequest
object to /canvas/save
url by POST method. Don't forget ContentType header./canvas/save
request, check that they have POST method, read request body json and save in the folder data
in separate file with current timestamp as name with json
extensionCanvas
page, that read the last json file from data
folder, and put it content in savedData
variable in page's javascript. Update javascript code such way, that in initialization it check savedData
variable and draw clicks from it.
Before we use more sophisticated tools for web-pages design, let's create more interesting business-logic. Our current goal - site, on which we could draw some sketches by mouse and save this sketches for users.
Tasks: