Note that there are some explanatory texts on larger screens.

plurals
  1. POASP.NET MVC, JSON & non JavaScript clients
    text
    copied!<p>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.</p> <p>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?</p> <p>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.</p> <p><strong>Update</strong></p> <p>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.</p> <p>Also I would prefer not to put that noise everywhere in the controllers (reminds me of ispostback from webforms...shudder).</p> <p>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)].</p> <p>There must be a better way than using that if statement everywhere.....</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload