# jsPsych experiment, token randomly consumed, no data stored

**URL:** <https://discourse.psychopy.org/t/jspsych-experiment-token-randomly-consumed-no-data-stored/22246>\
**Category:** jsPsych\
**Tags:** pavlovia\
**Created:** [April 13, 2021, 11:06am UTC](https://discourse.psychopy.org/t/jspsych-experiment-token-randomly-consumed-no-data-stored/22246 "2021-04-13T11:06:52Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![thomas\_pronk](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/thomas_pronk/32/9531_2.png) [@thomas\_pronk](https://discourse.psychopy.org/u/thomas_pronk)\
**Post date:** [April 16, 2021, 11:16am UTC](https://discourse.psychopy.org/t/jspsych-experiment-token-randomly-consumed-no-data-stored/22246/9 "2021-04-16T11:16:16Z")

</div>

@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.

> **[Thomas Pronk / jsPsych\_SimpleReactionTime](https://gitlab.pavlovia.org/tpronk/jsPsych_SimpleReactionTime)**
>
> Sign In/Register

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.

---

_[View the full topic](https://discourse.psychopy.org/t/jspsych-experiment-token-randomly-consumed-no-data-stored/22246)._
