使用AJAX和放大器; JSON VS在MVC行动的方法 [英] Using AJAX & Json vs Action Method in MVC
本文介绍了使用AJAX和放大器; JSON VS在MVC行动的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
什么是使用 AJAX
和 JSON
,而不是为操作方法CRUD之间的差异
操作(选择
,插入
,更新
和删除
)的 MVC
?例如,在使用的情况下文件上传操作, AJAX
可能是一个问题。在另一方面,使用的jQuery
, AJAX
和 JSON
代替标准 MVC
方法有助于提高网页的响应性,即确认创建和更新操作之后。任何帮助将是AP preciated。
What is the differences between using AJAX
and JSON
instead of Action Methods for CRUD
operations (Select
, Insert
, Update
and Delete
) in MVC
? For example in case using file upload operations, AJAX
might be a problem. On the other hand, using jQuery
, AJAX
and JSON
instead of standard MVC
methods helps to improve responsiveness of the pages i.e. confirmation after create and update operations. Any help would be appreciated.
推荐答案
- 在标准的MVC的操作方法有一个回发,但是当你使用AJAX回发发生在背景,使你的应用更加敏感和有一个应用程序的感觉。
- 在操作方法是很容易实现
@ Html.AntiForgeryToken()
使用AJAX prevent跨站请求伪造attacks.When你需要写一个小函数来实现同样的结果(很多人不这样做,导致一个安全漏洞)。 - 有一个大量的JavaScript在一个页面可以对页面加载times.Many公司产生负面影响,如Twitter,决定切换回服务器端渲染为确切原因的文章,以供参考。
- 当使用AJAX,你可能会遇到无障碍问题着,当然jQuery的最小化happenening的风险,但您仍可能会遇到与旧的浏览器和移动产品设备的操作方法的问题(服务器端),你没有这个问题。
- In standard MVC action methods there is a PostBack but when you use AJAX the PostBack happens in the background so your application is more responsive and has a feeling of an app.
- In action methods it's very simple to implement
@Html.AntiForgeryToken()
to prevent cross-site request forgery attacks.When using AJAX you need to write a little function to achieve the same result(many people don't do this, resulting in a security vulnerability). - Having a lot of javascript in a page can have a negative effect on page load times.Many companies, like Twitter, decided to switch back to server side rendering for that exact reason.Article for reference.
- When using AJAX you might run into accessibility issues, ofcourse jQuery minimizes a risk of that happenening but you still might experience problems with older browsers and mobile devices.With action methods(server side) you don't have that issue.
这篇关于使用AJAX和放大器; JSON VS在MVC行动的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文