Chapter 9. ASP.NET AJAX Networking

At the heart of AJAX development is the ability to make asynchronous Web service calls from JavaScript code. The major Web browsers have included an XMLHttpRequest object for making HTTP requests. The XMLHttpRequest object is used to perform out-of-band communications with the server for invoking Web services, executing callbacks, and performing partial page updates. This object allows the browser to send requests to the server and to receive data from the server without requiring the entire page to be posted back to the server and subsequently refreshed in the browser.

ASP.NET AJAX provides classes for managing Web requests, processing responses, and detecting errors. It also provides support for serializing objects formatted as JavaScript Object Notation (JSON), which makes them readily usable in JavaScript in the browser. JSON is a standard serial format that is more lightweight than XML. In this chapter, you learn how to use the ASP.NET JavaScript classes to perform networking tasks such as making synchronous and asynchronous HTTP requests, serializing .NET objects to and from JavaScript, and handling errors when Web requests do not execute as expected.

Get Professional ASP.NET 3.5 AJAX 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.