How do I get user data from database with Javascript?

How do I get user info from my database with javascript to use for a chart? I’m going to show a Google Chart on a page and it needs data about the user as variables.

Thank you!

One idea, you could always load the data to the page (as a text field, custom state, repeating group, etc.) and then reference it from there with JS.

Thanks! Is that the official way to do it though? Getting data via an element seems kind of weird. Anyway, how do I get the state from the element?

This isn’t my area of expertise, for sure. I can imagine a bunch of possible solutions but haven’t implemented this myself so probably best to see what someone with a bit more experience in this area has to say.

Hi there @pelle
I think this guide I wrote will help you!
Best wishes, Antony.