Skip to content

Save data periodically during the experiment #3188

Discussion options

You must be logged in to vote

Below is the code that I use. The idea is to disable the button at the start of the trial and to send the data at the same time. When the server returns a success response the button is enabled and the participant can continue.

    let save_data_trial = {
        type: jsPsychHtmlButtonResponse,
        stimulus: "Waiting for data upload to complete",
        choices:["Continue"],
        prompt: "",
        on_load: function(){
            document.getElementsByClassName("jspsych-btn")[0].disabled = true;
        },
        on_start: function(){
            let json_data = {
                'id'    : 1,
                'data'  : jsPsych.data.get().json()
            };

            let xhr 

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@dreamerie
Comment options

@ChristopheBossens
Comment options

Answer selected by dreamerie
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants