非JavaScript的客户

非JavaScript的客户

本文介绍了ASP.NET MVC,JSON和放大器;非JavaScript的客户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要确保我开发一个应用程序是accessable并且还与关闭JavaScript。我只是需要一个指针,以协助执行以下操作。

I need to ensure that an application I am developing is accessable and also works with JavaScript turned off. I just need a pointer to assist with the following.

我有3'链'选择框,我想启用JavaScript客户端有一个很好的Ajax体验。我可以随便写所需的功能来填充在preceeding的更改事件的链接框来选择使用jQuery和JSON的WCF服务。但是怎么样的非JavaScript客户端?

I had 3 'chained' select boxes and I wanted JavaScript enabled clients to have a nice Ajax experience. I can easily write the required functionality to populate the chained boxes on the change event of the preceeding select using jQuery and JSON with a WCF service. However what about the non JavaScript client?

我会换旁边选择一个提交,并把这些自己的表单内回发具有一定的行为或不同querstring参数?相同的控制器可以给我一个局部的JSON响应以及饲养全HTML响应。任何人都可以指向我一个很好的演示,利用这两个JSON和正常的HTTP职位,以产生ASP.NET MVC相同的结果。所有ASP.NET MVC演示/例子我看算了一下,不启用JavaScript客户端。

Would I wrap a submit next to the select and place these inside their own form to post back with a certain action or different querstring parameter? Can the same controller give me a partial JSON response as well as feeding the full HTML response. Can anyone point me to a good demo that utilises both JSON and normal HTTP posts to produce the same result in ASP.NET MVC. All ASP.NET MVC demo/examples I see forget about the non JavaScript enabled client.

更新

但对于Ajax调用使用Microsoft Ajax客户端库,如果我读corectly它不是真实的。道歉应该提到,

But isn't that true for Ajax calls using the Microsoft Ajax client library if I read it corectly - which I am wanting to avoid and use only jQuery - apologies should have mentioned that.

另外我想preFER不把噪声无处不在的控制器(让我想起了从Web表单的IsPostBack的......不寒而栗)。

Also I would prefer not to put that noise everywhere in the controllers (reminds me of ispostback from webforms...shudder).

这是一个耻辱,没有属性,我可以在控制器上使用像的[AcceptVerbs(HttpVerbs.Post)],但对于内容类型例如[AcceptType(httpTypes.Json)。

It's a shame there is no attribute that I can use on a controller like with [AcceptVerbs(HttpVerbs.Post)] but for content types e.g [AcceptType(httpTypes.Json)].

有一定比用更好的方式,如果声明无处不在......

There must be a better way than using that if statement everywhere.....

推荐答案

这文章对您的问题的一个优雅的解决方案:http://devlicio.us/blogs/sergio_pereira/archive/2008/12/05/reusing-views-in-asp-net-mvc-for-ajax-updates.aspx

This article has an elegant solution for your problem: http://devlicio.us/blogs/sergio_pereira/archive/2008/12/05/reusing-views-in-asp-net-mvc-for-ajax-updates.aspx

这篇关于ASP.NET MVC,JSON和放大器;非JavaScript的客户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 22:30