I have a case where I need to have a few global arrays and/or objects which will be used by numerous scripts. One example would be as a local lookup source for an autocompleter, while the same data might be used to populate a selection menu. The data isn't likely to change during a user's session, but might.
I can get this data remotely every time I need it, but I'm hitting some performance problems in doing so. What I'd like to do is load these arrays/objects on page load, but make them globally accessible to other scripts for fast lookup. I also would like to do this in a generic fashion that would allow me to reload those arrays or objects if needed. I'm stumped on how to do this though? .getJSON? One of the other jQuery Ajax functions? Where I'm lost is that the array or object would be populated in a callback. Do to scoping, I don't see how to make it global?