User data in Javascript

Hi everyone! I am new to Sparkle (or now Sitely) and I really love it!
But now I ran into a problem I need your help with: I would like to use the user-data (name, surname, username) from a logged in user in javascript. But I have no idea, how I could get these.

Is there a possibility to use smart fields in combination with javascript (run by button click) or another way to get the required data?

Thank you in advance!
Greetings,
Gaggi

This is kind of a more technical issue than is common for this community, but the answer isn’t super complex if you know your way around a little code.

The information you want is in the PHP session of the currently logged in user, so you can write a tiny amount of PHP code to generate a tiny amount javascript code, so that the current session contents are exposed as javascript variables.

Since this isn’t officially something we support, things might change in future versions of Sitely.

Thank you very much for the kind and fast answer! That helped me a lot, now the button does what it should do. :blush: