10 ms·
I've had a lot of success with embedding initial content for a page as JSON in a script tag with a specific ID and a type of "application/json". This way you ca
by deoxxa 12y ago
I've had a lot of success with embedding initial content for a page as JSON in a script tag with a specific ID and a type of "application/json". This way you can rely on the content being there and sidestep the whole timing issue completely. You can potentially speed up your loading time as well, if you have a bunch of things you'd usually fire additional requests off for.
I believe I got this idea from Backbone's documentation [1] originally, but I've seen it mentioned in other places as well.
[1]: http://backbonejs.org/#FAQ-bootstrap http://backbonejs.org/#FAQ-bootstrap