O'Reilly logo

Applied ASP.NET 4 in Context by Adam Freeman

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

Using Ajax to Post an HTML Form

The previous examples used the HTTP GET method, but we can as easily post data with Ajax, too. This is most commonly done to submit form data. The principal benefit of posting data with Ajax is that the page doesn't have to be reloaded, providing a smoother experience for the user. In this section, we'll start by building a regular ASP.NET form-based web page and then extend it to work with Ajax in different ways. This example will also demonstrate that Ajax isn't all about web services (although, in fairness, it often is, so I'll finish this section by showing you how to post to a web service).

Creating the Web Page

We will start by creating a simple form-based ASP.NET web page, called Calculator.aspx. This page ...

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