ASP.NET MVC AjaxHelpers推荐用法

时间:2021-03-31 03:21:38

It seems all the examples I come across specifiy an UpdateTargetId to render out the HTML content of the Ajax response. This is quite a bit different than how it's done in the Rails world, where the response content contains JavaScript code which manipulates the page. The Rails convention seems more powerful.

似乎我遇到的所有示例都指定了一个UpdateTargetId来呈现Ajax响应的HTML内容。这与在Rails世界中完成的方式有很大的不同,在Rails世界中,响应内容包含操纵页面的JavaScript代码。 Rails惯例似乎更强大。

What's the recommended usage that makes the ASP.NET MVC approach powerful? What are its advantages?

什么是使ASP.NET MVC方法强大的推荐用法?它的优点是什么?

1 个解决方案

#1


1  

There's no equivalent of Rails RJS generators in ASP.NET MVC though it might be implemented. So out-of-the box the Rails convention is more powerful, but IMHO it is questionable if returning Javascript from asynchronous actions is a good thing (Json and Xml are prefered).

虽然它可能已经实现,但是在ASP.NET MVC中没有Rails RJS生成器。所以开箱即用的Rails惯例更强大,但恕我直言,如果从异步操作中返回Javascript是一件好事(Json和Xml是首选),这是值得怀疑的。

#1


1  

There's no equivalent of Rails RJS generators in ASP.NET MVC though it might be implemented. So out-of-the box the Rails convention is more powerful, but IMHO it is questionable if returning Javascript from asynchronous actions is a good thing (Json and Xml are prefered).

虽然它可能已经实现,但是在ASP.NET MVC中没有Rails RJS生成器。所以开箱即用的Rails惯例更强大,但恕我直言,如果从异步操作中返回Javascript是一件好事(Json和Xml是首选),这是值得怀疑的。