I have one problem and since I am not very skilled with js, I would appreciate any advice.
Basically, I have an ajax call on article page executed every x seconds, that connects to database and checks for the comment number.
Now, after every call, I need to check if the last call returned number bigger than the previous call (to check if the number comments has increased).
I am having trouble figuring out how to properly store data of the single call that will be deleted after comparison with the next call, and of course overwritten by the new data.
Now, there are two methods that I could use and know how to: cookies and storing data in dom inside of the invisible element, but is that optimal solution?
you dont need to use cookies or dom to store this data. Just use closures*!
Closures are the reason why this works, if javascript did not have them you would not be able to modify the outer
oldvar in the$.getfunction.