First create your page on the server that can take a parameter to get some form of data and return matches found, in this case I just want to get a body of text from a database. Note that you want to prevent caching of the response in the browser above the include that supplies the connection string in this classic ASP server side script.

[codesyntax lang=”asp” lines_start=”1″]

pStr = "private, no-cache, must-revalidate"
Response.ExpiresAbsolute = #2000-01-01#
Response.AddHeader "pragma", "no-cache"
Response.AddHeader "cache-control", pStr
<!--#include file="../Connections/yourConnection.asp" -->
Dim ID
ID = Request("ID")

Set cmd = Server.CreateObject ("ADODB.Command")
cmd.ActiveConnection = ConnString
cmd.CommandText = "SELECT TOP 1 Message FROM dbo.Table WHERE ID = " & ID
Set rs = cmd.Execute
If rs.eof = false Then
End If

Set rs = nothing


Below you find the client webpage containing the code required to change the innertext of a textarea to the response returned by the page above. You don’t need to worry about uploading the JQuery API to your server as it’s hosted on Google’s CDN to make it load nice and snappy geographically.

[codesyntax lang=”html4strict” lines_start=”1″]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>AJAX post with parameters</title>
<script src="" type="text/javascript"></script>
<script type="text/javascript" language="JavaScript">


type: "POST",
url: "../AJAX/FilenameOfAboveScript.asp",
data: "caseid=<% =Request("ID") %>",
success: function(msg){



<form action="" method="post" name="form1">
<input name="id" id="id" type="hidden" value="<% =Request("ID") %>" />
<p><input name="getMessage" id="getMessage" type="button" value="get message" /></p>
<p><textarea name="message" id="message" cols="30" rows="20"></textarea></p>