13.9. ASP.NET MVC and JavaScript

ASP.NET MVC is very much set up for easy integration with popular JavaScript frameworks such as jQuery. For more information on jQuery, please refer to Chapter 12.

You will create a new edit page that utilizes the jQuery libraries to send the contents of a form to the edit controller. To do this, you will format the data as JSON. JSON stands for JavaScript Object Notation and is a very lightweight format to pass around simple classes and properties.

In the film example, a film class formatted as JSON might look something like this:

{ID:"1",Title:"Kung Fu Panda"}

JSON is very easy to construct and has the advantage that JavaScript frameworks understand JSON objects, allowing you to easily access properties with ...

Get Introducing .NET 4.0: with Visual Studio 2010 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.