|
-
May 3rd, 2011, 09:57 AM
#1
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.
-
May 3rd, 2011, 11:08 AM
#2
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.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
May 3rd, 2011, 11:11 AM
#3
Re: saving variables between stages
 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.
-
May 3rd, 2011, 11:16 AM
#4
Re: saving variables between stages
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|