Forum Moderators: coopster

Message Too Old, No Replies

How to auto save data JQuery/php/mysql

         

impact

2:39 am on Aug 11, 2010 (gmt 0)

10+ Year Member



Hello,

I am making a auto save text box in my site. The tutorial from which I am designing my site is here [jetlogs.org...]

This script shows the time at which the document was last saved. I think the best way, I can make my user understand that the document has been re-saved after his last action is to show "saving....." & followed by "saved!"

Due to my poor knowledge in php, I am not able to do this of my own, so any help will be appreciated.

Thank you,

enigma1

10:11 am on Aug 13, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



do few tests so you can see which part of the code is invoked and when. After the

if (title.length > 0 || content.length > 0) ......

add a simple alert
alert('saving');

then in the success clause

success: function(message) {
alert('saved');
}

Now that's not ideal but it will help you understand it better. Normally both saved and saving messages should come up inside the success/error functions based on what the server returns. Otherwise if there is no connection to the server the user may still think the document was saved because the jscripts run on the client end. See how to use json for the ajax call to retrieve from the server the response with some meaning.

type: "POST",
url: "autosave.php",
.......
dataType: 'json',