第三步:把数据发送给asp脚本进行处理.
<%
Response.ContentType = "text/html"
Response.Charset = "GB2312" '解决乱码问题
response.buffer=true '禁止缓存
response.expires=0
dbDir="ajax.mdb"
set conn=Server.CreateObject("ADODB.Connection")
connStr="provider=microsoft.jet.oledb.4.0;data source="&server.MapPath(dbDir)
conn.open connStr
Set rs=Server.CreateObject("ADODB.Recordset")
Sub CloseConn()
Set rs=Nothing
conn.close
Set conn=Nothing
End Sub
mydo=request.QueryString("mydo")
If mydo="CheckUser" Then
UserId=Trim(request.QueryString("UserId"))
if UserId="" then
response.Write"ID不能为空!"
response.end
end if
sql="select *from [user] where UserId='"&UserId&"'"
rs.open sql,conn,1,3
if rs.eof then
response.write"succese! 您可以注册"&UserId
else
response.write"false! "&UserId&"已经被别人抢注"
end if
Call CloseConn()
End If
%>
好了ajax用户检测己经做完了.