form.reset();
}
+
+function new_loadend() {
+ if (this.status == 200) {
+ /* Response contains the game ID which we simply point the browser to. */
+ const game_id = JSON.parse(this.response);
+ window.location.href = ('/' + game_id);
+ return;
+ }
+
+ add_message("danger", `An error occured creating a new game (${this.status}).`);
+}
+
+function lmno_new(engine) {
+ console.log("In lmno_new");
+ const request = new XMLHttpRequest();
+ request.addEventListener("loadend", new_loadend);
+
+ request.open("POST", "/new/" + engine);
+ request.setRequestHeader("Content-Type", "application/json; charset=UTF-8");
+ request.send();
+
+ return false;
+}