htmlajaxcookieshidden-fields

Using html hidden fields for storing temporary data


I'm plotting a graph using javascript flot library. When hovering or clicking i need to show more information. To do this, i'll need some more info. But flot will give me only the ( x, y ) co-ordinates of the clicked point.

Can I store the info needed in html hidden fields ? Is it OK/Bad? Or should I use cookies? What about making extra ajax calls to fetch info ?

Thanks


Solution

  • You can do either JavaScript variables or hidden fields. The main benefit to using hidden fields would be if you end up submitting a form the data would already be in place.