Forum Moderators: coopster

Message Too Old, No Replies

Take attendance offline

Save until there is a connection

         

dvduval

6:46 pm on Oct 23, 2014 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have a customer that doesn't always have a solid internet connection. They are using our PHP app to take attendance. Basically, they just toggle a switch to say present or absent, and with ajax we update the database on the web server. What do you think the simplest way would be to let her take roll for 3-4 classes while offline, and then refresh the server db once she is back online. Any ideas?

brotherhood of LAN

6:53 pm on Oct 23, 2014 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Not entirely sure what you mean, though it sounds like localstorage and some javascript would be useful.

When they check back in you can check if data is in sync or if there's anything new in localstorage for you to look at.

dvduval

8:19 pm on Oct 23, 2014 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



So normally we use a web page, and not sure what to do to temporarily store data from the app locally. I'll look for "localstorage" and see what comes up in a search.

penders

11:24 pm on Oct 23, 2014 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I think along the lines of what brotherhood of LAN suggests.

I'm just curious what you currently do when your "ajax request to update the database on the web server" fails?

A. Fail silently
B. Fail with a big error message
C. Place a discrete warning notice somewhere on the page, queue the failed request and try again in a short while.

The "queue" could simply be in memory, or localstorage (or even a cookie) to make it a bit more permanent.