O'Reilly logo

ASP.NET MVC 2 Cookbook by Richard Kimber, Andrew Siemer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hijaxing a form with jQuery

In this recipe, we are going to take a look at how we can override the form submission process. Sometimes you may want to enable the user to POST a form without refreshing the whole page. I usually do it because I either want to preserve some other piece of information on the page, or because I want to preserve the page's state within the browser. Examples I can think of might be scroll position, or the form exists within a modal created with JavaScript. You might be tempted to achieve a similar result with an IFRAME, hopefully this recipe will show you that a ASP.NET MVC/jQuery solution is a lot more elegant.

Getting started

In addition to jQuery 1.4.1, we're going to be using one of the official jQuery plug-ins called ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required