I’m buiding an HTML/jQuery site where almost all the content comes from remote JSON data. I’m having trouble coming up with a good way to store and access the data in the future (scope-wise).
Currently, I’ve written a jQuery plugin that gets the JSONP data when the site loads. But I have other functions and jQuery plugins that need to access this data.
Where should this data be stored so other functions and plugins can access it?
Should it be a global variable?
If it matters, this site will only run on the iPad and the back-end of the site is in Rails.
I would suggest you investigate HTML5 persistant storage which is supported on Safari and Mobile Safari as a SQL Lite DB. If you decide not to go down that route I would opt for $().data() over a global variable in JavaScript.