Loaded saved game in web player has nothing in #divOutput

function saveGame() {
    window.setTimeout(function () {
        var saveData = $("#divOutput").html().replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
        $("#fldUIMsg").val("save " + saveData);
        $("#cmdSubmit").click();
    }, 100);
}

function saveGameResponse(data) {
    addText("Saving game...<br/>");
    $.ajax({
        url: apiRoot + "games/save/?id=" + $_GET["id"],
        success: function (result) {
            if (result.Success) {
                addText("Game saved successfully.<br/>");
            } else {
                addText("Failed to save game: " + result.Reason + "<br/>");
            }
        },
        error: function (xhr, status, err) {
            console.log(status);
            console.log(err);
            addText("Failed to save game.<br/>");
        },
        xhrFields: {
            withCredentials: true
        },
        type: "POST",
        data: {
            data: data
        }
    });
}

That's how the web player saves the data from #divOutput.

So how can we retrieve that data?

(I've tried reading the docs on ajax, but I can't figure this out at all.)


Log in to post a reply.

Support

Forums