开发者

jQuery based AJAX sessions in CakePHP 1.3

First of all, because I've got very little JS/jQuery experience, this entire thing will be a learning curve for me - so please excuse any dumb questions that I may ask :)

I've got an interactive fiction site on which users can submit their own chapters to stories. One of the problems I have is that the user's session can sometimes times out before they're finished writing the chapter, meaning when they submit, they're logged out (then logged in again, see below), and loose all their work... Not good.

I do have a cookie set and use autologin, though this doesn't solve the problem (the user is re-logged in after submitting the form, but the content of the form vanishes).

So, in an effort to solve this problem, I thought it could be a good idea to use jQuery AJAX to perform some type of auto-save as they're typing.

The idea is that 开发者_如何转开发the content of the form gets automatically saved in a session variable array every few seconds, which, in theory, does two things - first, it will keep the session active, meaning that it won't time out, and second, it means they can leave the page, then return to it, with everything they've written so far being auto-populated into it.

The problem is that I don't know how to get started on such an endeavour, which is why I was hoping that some kind soul here might be able to point me in the right direction?

Thank you.


Simplest solution is change session expire time to couple of hours Configure::write('Session.timeout', '144'); and hold the values of chapter contents in session and until the press save button.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜