Coder Social home page Coder Social logo

Comments (5)

kristian-lange avatar kristian-lange commented on June 3, 2024

Is jatos.urlQueryParameters deprecated?

No, it's not. I just tried it and it worked for me, returning an object. How do you call it in JS?
image

And it looks like the URL in the Reference seems to be a past version. The URL now does not contain the start?.

Yes, you are right, it's outdated. I'll update it. Thank you for pointing this out. Please, if you find more of those, tell me ;)

from jatos.

St-ZFeng avatar St-ZFeng commented on June 3, 2024

I use console.log(jatos.urlQueryParameters) at the top of the body part in my JS. The output in the console is as follows.
image

I also try to use the URL "http://127.0.0.1:9000/publix/[code]?foo=bar&a=123", but the output is still undefined.

from jatos.

kristian-lange avatar kristian-lange commented on June 3, 2024

I made a mistake in the updated docs: the first one is an ? - not an &. So it has to be http://127.0.0.1:9000/publix/[code]?foo=bar&a=123 like you already used :)

But it works for me. I just tried it:

image

Though you can only call it after jatos.js initialized. So, you have to call it from jatos.onLoad (https://www.jatos.org/Write-your-own-Study-Basics-and-Beyond.html#mandatory-lines-in-your-components-html):

jatos.onLoad(function() {
  console.log(jatos.urlQueryParameters);
}

from jatos.

St-ZFeng avatar St-ZFeng commented on June 3, 2024

Oh, that is indeed the main reason. But that means there seems to be no way to change my jspsych component parameters based on the prolific PID. Or I can define the component after jatos is initialized.

I'll try that later. Thanks for your help.

from jatos.

kristian-lange avatar kristian-lange commented on June 3, 2024

It should be no problem: The easiest is to just wrap all JS you have, including all jsPsych code, with jatos.onLoad:

jatos.onLoad(() => {
  // everything goes in here
}

from jatos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.