saving variables between stages
a lot of times i have to save certain variables in ajax/javascript. What is the best practice way to save such variables....
right now i save them as hidden form fields and assign them an id and access them later... but im wondering if this is the right way to do it.
i do know another method of saving it is using cookies... if there are other i donot know... so plz fill in wat you think is the way to store variables for use by jquery/javascript
i know this is not exactly server side but it has ajax involved and i wasnt getting any response from the ajax forum so thought i would paste here.
Re: saving variables between stages
Unless you want a server-side solution, I'm going to move this to client-side scripting.
As for your problem, client-side storage is very limited. As you've already mentioned, you have <input> and cookies. Other than that, you will have to go server-side. I'm going to already assume that the information your passing is not volatile. If it needs security...then ALWAYS use server-side storage methods.
So, with that in mind, as long as your information is not large, there's no reason why you shouldn't just use forms. If you're passing this across multiple pages, you will want to look into cookies. Or, to keep your HTML output to a minimum, sometimes you may want to use cookies as well.
Re: saving variables between stages
Quote:
Originally Posted by
PeejAvery
Unless you want a server-side solution, I'm going to move this to client-side scripting.
As for your problem, client-side storage is very limited. As you've already mentioned, you have <input> and cookies. Other than that, you will have to go server-side. I'm going to already assume that the information your passing is not volatile. If it needs security...then ALWAYS use server-side storage methods.
So, with that in mind, as long as your information is not large, there's no reason why you shouldn't just use forms. If you're passing this across multiple pages, you will want to look into cookies. Or, to keep your HTML output to a minimum, sometimes you may want to use cookies as well.
perfect, makes sense.
Re: saving variables between stages