Skip to content
Discussion options

You must be logged in to vote

I've solved this problem by myself, but I'm not sure if this approach is correct.
If you notice anything let me know.

I made a very simple PHP file like this as getCompletionCode.php.

<?php
    echo '1234'; // This is the fixed code
?>

The following code is written in the experiment file.

    let completion_code;
    const getCode = {
        type: jsPsychCallFunction,
        async: true,
        func: function(done){
            console.log('getCompletionCode')
            const xhr = new XMLHttpRequest();
            xhr.open('POST', 'getCompletionCode.php');
            xhr.setRequestHeader('Content-Type', 'application/json');
            xhr.onload = function() {
                if(xhr.

Replies: 1 comment 2 replies

Comment options

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

@kurokida
Comment options

Answer selected by kurokida
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