@DonShirley and @Lillian_XU, I went ahead and added a little feature to our jsPsych Pavlovia plugin, updating it to version 2020.3. It now offers a completedCallback
which is called once the data is in. The demo below contains the updated plugin and an illustration on how to use it.
This is how I tested it: the demo task only sends a tiny bit of data, but via the Network Panel in your browser’s Developer Tool, you can simulate an extremely slow internet connection. While simulating a low connection, this happened:
- After completing the task I saw the text
Please wait a moment while the data are uploaded to the pavlovia.org server...
for a couple of seconds - Then the alert that says
data successfully submitted!
appeared. In the Network Panel I could see that this happened after all the network requests had resolved.
If you put your redirect in completedCallback
, that should fix the data issues.