AJAX VS表单提交 [英] AJAX vs Form Submission

查看:121
本文介绍了AJAX VS表单提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们拉从服务器和,如果我们使用Struts,那么我们就可以拉或者通过提交网页,其中数据MVC架构或我们凸轮做出的 AJAX调用但约定的使用形式和呈现响应,但我们也面临着挑战,让丰富的用户体验,所以我们妥协公约,并开始使用过多的AJAX技术,所以我们应该如何让两者之间的平衡?

We pull data from server and for that If we are using Struts, then we can pull either by submitting a page which MVC Architecture or we cam make an AJAX call but conventions is of using forms and render response but we also face challenges to give rich user experience, so we compromise convention and start using excessive AJAX, so how we should make balance between two?

推荐答案

我个人认为AJAX应该用于显示器的更新和表单提交应通过重新加载页面来完成。推理?

I personally think that AJAX should be used for displays updates and form submissions should be done via a page reload. Reasoning?

当提交表单,你告诉应用程序做一些事情。用户往往想感受它做。当一个页面没有加载,用户常常在想,难道这项工作?。然后,他们必须检查,以确保他们的所作所为是正确的。

When submitting forms, you are telling the application to do something. Users tend to want to feel that it was done. When a page doesn't reload, users are often left wondering "Did that work?". Then they have to check to make sure what they did was right.

在另一方面,当你显示一个图表什么的,用户说要显示2011数据....现在2012的数据来说吧,他们不是做事(创建新的实体,发送电​​子邮件等)。所以AJAX能够提供在这种情况下,良好的用户界面。重新加载页面将是恼人这里。

On the other hand, when you are displaying a chart or something, and the user says to "display 2011 data....now 2012 data" for instance, they aren't "doing" something (creating new entities, sending emails, etc). So AJAX can provide a nice user interface in this case. Page reloads would be annoying here.

在最后,我想表单提交应通过重新加载页面来完成(让用户看到它的工作),而显示的更新应该使用AJAX(prevent恼人的页面重新加载)。

In conclusion, I think form submission should be done via page reloads (let the user see it working), whereas display updates should use AJAX (prevent annoying page reloads).

当然,这是一个preference的事情。我的一些公司的应用程序中使用AJAX全部结束。但这些是最难以维护和调试的应用程序。 ;)

Of course, this is a preference thing. Some of my company's applications use AJAX all over. But those are the applications that are the most difficult to maintain and debug. ;)

这篇关于AJAX VS表单提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆