AJAX 每个表单元素?
单独使用 AJAX 每个表单元素(例如发送 onChange 请求等)或收集所有数据,然后通过一键保存提交是否更好?
本质上是自动保存还是用户启动保存?
Is it better-practice to AJAX every form element separately (eg. send request onChange, etc) or collect all the data, then submit with 1 click save?
Essentially, auto-save or user-initiated-save?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我通常会说,用户启动的保存是大多数 Web 应用程序的最佳选择。如果没有别的原因,这就是用户习惯与网络应用程序交互的方式;熟悉度和易用性在 Web 应用程序中极其重要。更不用说它可以减少不必要的流量。
这并不是说自动保存没有它的用武之地,但它常常会造成不必要的流量。例如,如果我自动保存联系表单,填写我的姓名,然后发送电子邮件,然后返回姓名进行更改,这已经发送了 3 个请求,但没有带来任何好处 - 这是额外的工作,没有任何额外的好处。
再说一遍,我认为这确实与您的应用程序或您计划使用它的位置有很大关系。内联编辑经常使用自动保存,我认为它很有用,而联系表单/注册表单不是一个好主意。
I would generally say that a user-initiated save is the way to go for most web-applications. If for nothing else, this is how users are used to interacting with web apps; familiarity and ease of use is extremely important in web applications. Not to mention it can cut down on unnecessary traffic.
This is not to say that auto-saving does not have it's place, but often it can be cause unnecessary traffic. For example, if I am auto-saving a contact form, fill out my name, then email, then back to name to change it, that is already 3 requests that have been sent with no benefit - this is extra work for no added advantage.
Once again, I think it does have a lot to do with your application or where you are planning on using it. Inline edits are something that often uses auto-saving and there I think it is useful, whereas a contact form/signup form would not be a good idea.
我想说这取决于您的应用程序的性质以及“自动保存”是否是您的用户所需的行为。
“用户发起的保存”是用户对当今网络表单体验的期望 - 除非有充分的理由,否则我不会偏离这一点。
I'd say that depends on the nature of your application and whether "auto-save" is a behaviour desired by your users.
"User initiated save" is what a user would expect from their experience with web forms nowadays - I would not deviate from that unless there's a good reason.
取决于以下因素:
Depends on following factors: