I'm using JS Objects to sort and filter a table but I need to store the original table data in case the user wants to return to it. I'm just wondering if there's an easy way to pass the object's data to a PHP session var, via AJAX, and retain stuff like the key/value relationships without doing a lot of heavy lifting.
4
-
Where are you getting the table data to begin with?jessegavin– jessegavin2011-01-17 16:17:54 +00:00Commented Jan 17, 2011 at 16:17
-
mysql query - I do store the original query in a session so I guess, duh, I could just resubmit it.PruitIgoe– PruitIgoe2011-01-17 16:32:39 +00:00Commented Jan 17, 2011 at 16:32
-
1Yeah that's kind of where I was going with that question.jessegavin– jessegavin2011-01-17 16:35:34 +00:00Commented Jan 17, 2011 at 16:35
-
Pointing out my inefficiencies of thought is so unkind... : DPruitIgoe– PruitIgoe2011-01-17 16:42:28 +00:00Commented Jan 17, 2011 at 16:42
Add a comment
|
2 Answers
2 Comments
PruitIgoe
Thanks Dr.Molle, I've never worked with JSON before, I'll check it out.
Bob Baddeley
php has json_encode and json_decode functions to make the JSON to/from process even easier.
It's not possible.
On the client side, the session is identified by a cookie. The session ID is all you've got.
On the server, the session data is stored in a binary file, one file per session (typical scenario).
So you can't touch the contents from the session from the browser without help from the server.
And second: it's not "light". In an app I've been working on, modern computer and virtually no load yet, loading the session seem to be taking around 250ms, 10 times longer than the response time for the whole page when starting from scratch.
In summary:
- you cannot touch session variables without writing a script on the server that handles the data
- It's not "light".