繁体   English   中英

在为 mySQL 查询构建工作订单时,localStorage 是 go 的好方法,用户是否离线?

[英]Is localStorage a good way to go when building an workorder for mySQL query is user is offline?

我正在构建一个 web 应用程序,该应用程序将在用户上线时更新 MySQL。

我有用户输入数据的表单。
The formData saves into "localStorage" is the user is offline and when the user goes online a javascript is fetching data from the localStorage and then send it through AJAX to PHP and MySQL.

这是 go 的一种方法,还是有更好的方法为离线用户创建列表?

我还使用 serviceWorker 来缓存 static html 和 js 页面。

//ADD DATA TO localStorage (data contains the formData)
localStorage.setItem(id, JSON.stringify(data));

//FETCH DATA (this is in a loop)
JSON.parse(localStorage.getItem(key));

我猜是..

我这样做了,效果很好

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM