Listing 1: HTMLStartPage.htm

<html><head><script>
var objRequest;

function SendValue(val)
{
     //Initialize *************************************
try
    {	//MS IE Browsers
	objRequest=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e)
    {
	try
        		{//All Non-IE Browsers
		objRequest=new ActiveXObject("Microsoft.XMLHTTP");}
        	catch(oc)
        		{objRequest=null;}
    }

if(!objRequest&&typeof XMLHttpRequest!="undefined")
    {	objRequest=new XMLHttpRequest();}
	//*********************************************

//Web page that handles requests
var url="http://localhost/VBNETSample/HandleAjaxRequests.aspx?sStringIn=" + val;

    if(objRequest!=null)
    {   objRequest.onreadystatechange = Process;
        objRequest.open("GET", url, true);
        objRequest.send(null);
    }
}

function Process()
{
    if (objRequest.readyState == 4)
	//A "4" value means we can now use the XMLHttpRequest returned data
	    {  if (objRequest.status == 200)
{ document.getElementById("txtEchoOutPut").innerText = objRequest.responseText;
	//IE
	//document.getElementById("txtEchoOutPut").innerHTML = objRequest.responseText;
	//Other browsers
            }
            else
{ document.getElementById("txtEchoOutPut").innerHTML= "There was a problem retrieving
 data:<br>" + objRequest.statusText;}
        }
}
</script>
</head>
<body>
<form name="frm1" ID="frm1">
Type in this text box:<input name="txtStart" onKeyUp="SendValue(this.value)"
 style="WIDTH:500px"><br>
Output will appear here:<input name="txtEchoOutPut" id="txtEchoOutPut"
 style="WIDTH:500px" >
</form></body></html>

Listing 2: HandleAjaxRequests.aspx

Public Class HandleAjaxRequests
    Inherits System.Web.UI.Page

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
	 Handles MyBase.Load
        Dim sStringOut As String 'Create a string variable to echo back to the browser

sStringOut = "You typed: " + Request.QueryString("sStringIn").ToString()
        Response.Write(sStringOut) //Echo back the text that we received
    End Sub
End Class

Additional Code for this Article zip file ~35 KB