intellix Posted December 2, 2010 Share Posted December 2, 2010 Hey guys... quick question I have jQuery using JSON to pull in aload of data... Within the JSON request, when it returns data, I have a loop that adds stuff to an object and then updates the page... It uses a variable I want to update at the same time. If I make the request and I start playing with the site, I want the function at the end of the loop to use the latest data (as JSON isn't instant and I don't want to lock the page from the user updating it)... Can I update the variable whilst the JSON request, loop is running and then when it gets to the end of it, the variable will be updated? Or does JavaScript work on a queue sort of basis where it will finish the JSON request, loop first until I can start updating variables that will be used at the end of it all? Thanks, Dom Quote Link to comment https://forums.phpfreaks.com/topic/220513-json-loop-and-updating-variables-at-same-time/ Share on other sites More sharing options...
intellix Posted December 2, 2010 Author Share Posted December 2, 2010 Also in terms of performance... Say if I have a 250kb JSON script pulled and put into an object like: var $largeData = jsondata; Once I've done with it, do you think its good to set it to null or something to free memory? Or is this done automatically and not needed? Quote Link to comment https://forums.phpfreaks.com/topic/220513-json-loop-and-updating-variables-at-same-time/#findComment-1142412 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.