aspx, which will look something like
Default2.aspx?A=8&B=3. It then calls the open method on XMLHttpRequest, passing it this
URL and indicating that this will be an asynchronous process. Next, it specifies the
doUpdate function to handle the readystate changes on the XMLHttpRequest object.
To get this application to work, add a new C# web form to the project, and leave the
default name of Default2.aspx. In the page designer, delete all of the HTML so that the
page contains just the ASPX Page directive:
<%@ Page language="C#"
CodeFile=???Default2.aspx.cs???
AutoEventWireup="true"
Inherits="Default2" %>
CHAPTER 1 ?– INTRODUCING AJAX 14
Then add the following code to the C# code file??™s Page_Load method (you can add it by
double-clicking the Default.aspx page when it is shown in the design window of Visual
Studio 2005):
int a = 0;
int b = 0;
if (Request.QueryString["A"] != null)
{
a = Convert.ToInt16(Request.QueryString["A"].ToString());
}
if (Request.QueryString["B"] != null)
{
b = Convert.ToInt16(Request.QueryString["B"].ToString());
}
Response.Write(a+b);
This handles the asynchronous request from the page Default.
Pages:
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58