You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 11, 2024. It is now read-only.
Currently the button is visible, and runs a JavaScript function when clicked.
Bug in function:
When running the function, the canvas data URL is captured and sent in a form using AJAX. The AJAX does send the form to the server, but the server throws a 400 error saying it didn't get anything.
Server Code:
@app.route('/game/<id>', methods=["POST", "GET"])
def serveGameUpdate(id):
if request.method == "POST":
print('Getting Data')
data = request.form['map']
FileStorage(stream=data).save(SERVER+id, id+'.png')
return 'ok'
Client Code:
save: function() {
let img = game.map.canvas.toDataURL("image/png")
let form = new FormData;
form.append('map', img);
form.append('id', data.id);
let ajax = new XMLHttpRequest();
ajax.open("POST",window.location.href);
ajax.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
ajax.send(form);
}