Kiosk web-app: re-submit data after failed request
-
02-07-2021 - |
سؤال
I've built a web-app to run on an iPad, effectively functioning as a kiosk. The app collects basic data like Name, Address and Email. This is then sent to a remote MySQL database.
Is there any way I can safeguard the entries in the event that WiFi/3G connectivity drops? For example, failed submissions could be stored in an array or localStorage until a connection is re-established.
Does this sound feasible?
المحلول
I found that this was an overcomplicated way of solving a simple problem.
I'm now saving JSON strings to localStorage and pushing those those to the live server every n seconds. Check for window.navigator.online
; if the AJAX request succeeds then localStorage records are erased.
لا تنتمي إلى StackOverflow