help with jspsych and JATOS
Hi!
I'm recently working on buliding an online perception experiment by using jspsych. However, when I try to put the last lines of javascript:
var jsPsych = initJsPsych({
show_progress_bar: true,
on_finish: function() {
var resultJson = jsPsych.data.get().json();
jatos.endStudy(resultJson, true);
}
});
The end page is totally blank, and the JATOS results webpage still shows "not finished yet" in each response...
And if I use the line:
jatos.onLoad(function() {
var jsPsych = initJsPsych({
timeline: timeline,
show_progress_bar: false,
on_finish: function() {
var resultJson = jsPsych.data.get().json();
jatos.endStudy(resultJson, "success");
}
});
Then the whole experiment is blank!
In the beginning, I do put the line "<script src="jatos.js"></script>"..Im suspecting that maybe because I use jspsych 8.2.1 not 7 (because the instructions given on JATOS use jspsych 7 //https://www.jatos.org/jsPsych-and-JATOS.html)?
Im totally a beginner of programming, sorry for my questions sound basic..
Thank you for your help and time!
Comments
Hi!
I took the liberty to format your code examples and I encourage everyone to do the same - it makes it much more readable.
I'm just looking into jsPsych 8 and there seem to be no difference in how to use it together with JATOS.
You need three parts (just like written in https://www.jatos.org/jsPsych-and-JATOS.html):
1) Include the jatos.js library in the
<head>section of your HTML file:2) in
initJsPsychtheon_finishhas to point atjatos.endStudyor a similar function likejatos.startNextComponent:. As far as I understand jsPsych thetimelinedoes not go here.var jsPsych = initJsPsych({ show_progress_bar: true, on_finish: () => jatos.endStudy(jsPsych.data.get().json()) });3) Wrap
jsPsych.runwithjatos.onLoadand here goes your jsPsychtimeline:jatos.onLoad(() => { jsPsych.run(timeline); });This should do it.
Best,
K.
Dear Kri,
I paste the code you give me, then the whole experiment (from the very first page becomes blank..), its relly weird...
Do you get any errors in the browser's console? And can you please post your code here?