Using data from mySQL database across multiple scenes

Hi all,

I'm attempting to use pulled data from a mySQL database across multiple scenes after getting the data using ajax. However, when I run the javascript function, the data returned is only used in the scene I'm requesting it on and if I transition to another scene I can't seam to use the data just received. This means that currently I'm having to call the same javascript function every time I want to access the database on various scenes.

Is there a way in which I can pull the data from the database to store in the background to use once a scene loads or could the data pulled possibly populate the other scenes in advance?

Thanks in advance for any help you can offer me with this,


If you can get the data in, you can store it in the 'window' object to retain that information across scenes. Alternatively, you could set it a bit more durably (even across page reloads) by using localstorage. More info on that here:

And there are a few examples here:


Thanks for your quick reply :slight_smile:

I’m moving away from my computer now but I will give this a go tomorrow and update. Thanks for your help

Thanks for your help @Daniel. You pointed me in the right direction and I've decided to use sessionStorageas as I didn't want to keep the data retrieved between page refreshes. It works great thanks :slight_smile:

1 Like