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

Adding a jQuery delete link with confirmation

In this recipe, we will take a look at how we can safely delete a record using a link. We will use jQuery to override the normal GET functionality of a link and replace it with a POST action. We will add a JavaScript confirmation to make sure they don't accidentally delete data. Also, because we can't guarantee that everyone is able to utilize JavaScript, we will provide an intermediary delete confirmation step.

Getting ready

In this recipe, we will build from the previous recipe where we created an intermediate delete confirmation page. The delete to intermediate "Are you sure?" page is great for folks who don't have JavaScript capabilities. However, why make those with JavaScript suffer? For that ...

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