Debt Consolidation - Wordpress magazine themes - Watch Anime Online - Debt Consolidation - Web Hosting

PDA

View Full Version : Smart AJAX autosave?


Triexa
Dec 5th 2006, 12:51 pm
I have an autosave feature that, well... autosaves every minute. Now I could very well become the biggest abuser of my own feature. I currently have 8 windows open - I tend to just leave windows open for a long time. As a result, the javascript would be running every minute saving, creating unnecessary load on the server.

How could I make the autosave smart and only save if they are actively "working" with it? The only thing I can really think of is to have like a variable that sets to true whenever something happens, set to false whenever it saves, and only save when the var is true. Problem is, I have a lot of functions for events that I would need to attach it to... I'm sure I would miss it somewhere.

Any other ideas?

krakjoe
Dec 5th 2006, 12:54 pm
Can I have a look at the page in question so I can see what you're on about ?

smallbuzz
Dec 5th 2006, 5:30 pm
Can you put a key press event on the body element of all the pages? Whenever a key is pressed, set a global variable to true. Save only if that variable is true, reset it to false afterwards.

Triexa
Dec 5th 2006, 6:00 pm
Can you put a key press event on the body element of all the pages? Whenever a key is pressed, set a global variable to true. Save only if that variable is true, reset it to false afterwards.

99.9% sure you can't attach any key event to the body...

smallbuzz
Dec 5th 2006, 6:40 pm
how about wrap the page in a div, then you can put an event on it