15.02.2015 Views

C# 4 and .NET 4

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

1220 ❘ ChaPTer 41 Asp.net feAtures<br />

(continued)<br />

TeChnology<br />

JavaScript<br />

XML<br />

XMLHttpRequest<br />

desCriPTion<br />

JavaScript is a client-side scripting technology that enables you to execute code inside<br />

a web browser. The syntax of JavaScript is similar to other C-based languages, including<br />

<strong>C#</strong>, <strong>and</strong> provides variables, functions, branching code, looping statements, <strong>and</strong> other<br />

familiar programming elements. However, unlike <strong>C#</strong>, JavaScript is not strongly typed, <strong>and</strong><br />

debugging JavaScript code can be difficult. In terms of Ajax programming, JavaScript is<br />

a key technology because it allows dynamic modifications to web pages by way of DOM<br />

manipulation — among other functionality.<br />

XML, as you have seen throughout this book, is a platform-neutral way to mark up<br />

data <strong>and</strong> is crucial to Ajax both as a way to manipulate data <strong>and</strong> as a language for<br />

communication between the client <strong>and</strong> the server.<br />

Since Internet Explorer 5, browsers have supported the XMLHttpRequest API as a<br />

means of performing asynchronous communication between the client <strong>and</strong> server. This<br />

was originally introduced by Microsoft as a technology to access e-mail stored in an<br />

Exchange server over the Internet, in a product known as Outlook Web Access. Since<br />

then, it has become the st<strong>and</strong>ard way to perform asynchronous communications in web<br />

applications, <strong>and</strong> is a core technology of Ajax-enabled web applications. Microsoft’s<br />

implementation of this API is known as XMLHTTP, which communicates over what is often<br />

called the XMLHTTP protocol.<br />

Ajax also requires server-side code to h<strong>and</strong>le partial-page postbacks as well as full-page postbacks. This<br />

can include both event h<strong>and</strong>lers for server-control events <strong>and</strong> Web services. Figure 41-13 shows how these<br />

technologies fit together in the Ajax web browser model, in contrast to the “traditional” web browser model.<br />

Prior to Ajax, the first four technologies listed in the preceding table (HTML, CSS, the DOM, <strong>and</strong><br />

JavaScript) were used to create what was known as Dynamic HTML (DHTML) web applications. These<br />

applications were notable for two reasons: they provided a much better user interface, <strong>and</strong> they generally<br />

worked on only one type of web browser.<br />

“Traditional” Web Browser Model<br />

Web Browser<br />

HTTP Request<br />

Web Server<br />

HTML<br />

Document<br />

HTTP Response<br />

Ajax Web Browser Model<br />

Web Browser<br />

Ajax<br />

Client-Side<br />

Code<br />

JavaScript<br />

CSS<br />

DOM<br />

XMLHttp Request<br />

Web Server<br />

Ajax<br />

Server-Side<br />

Code<br />

(X)HTML<br />

figure 41-13<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!