Chapter 7. Ajax in ASP.NET MVC

 

This chapter covers

  • Unobtrusive Ajax using jQuery
  • ASP.NET MVC’s Ajax helpers
  • JSON responses and client-side templates
  • jQuery UI’s Autocomplete plugin

Most of the examples that we’ve looked at so far have focused on using the server-side components in ASP.NET MVC to render views and send them to the browser. But with the increased performance of modern web browsers, we can often move much of our rendering logic to the client. This can result in applications that are far more interactive and user friendly.

Although there are many client-side technologies available on today’s web (including Adobe Flash and Microsoft Silverlight), the most popular is undoubtedly JavaScript due to its ubiquitous support across all modern web browsers. Today, many web applications rely heavily on JavaScript to produce rich user experiences that can almost mimic the instant responses of a desktop application (popular examples include Gmail, Facebook, and Twitter) and Ajax is one technique that can be used to achieve this.

Ajax is a term initially coined by Jesse James Garrett to describe the technique of using JavaScript to make an asynchronous request with a web server and dynamically update a section of the page with the result, all without having to do a full-page refresh. You make these calls from the client, and the server running ASP.NET MVC can generate the content that the client-side code can then use to manipulate the page.

7.1. Ajax with jQuery

7.2. ASP.NET MVC Ajax helpers

7.3. Ajax with JSON and client templates

7.4. Creating an autocomplete text box

7.5. Summary

sitemap