最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
AJAX asp 查询数据库并得到返回值
时间:2022-06-29 14:25:46 编辑:袖梨 来源:一聚教程网
function checkdomain(){
var domain = document.getelementbyid("domain").value;
if(domain == ''){
alert("请填写域名!");
document.getelementbyid("domain").focus();
return false;
}
var info=domain.match(/^[a-z0-9]+$/);
if(!info){
alert("域名必须是字母和数字组成!");
document.getelementbyid("domain").focus();
return false;
}else{
var xml=window.activexobject ? new activexobject("microsoft.xmlhttp") : new xmlhttprequest();
xml.open('get','/index.asp?r=company/checkdomain&domain='+domain,true);
xml.send('');
xml.onreadystatechange = function()
{
if(xml.readystate == 4 && xml.status == 200)
{
var result = xml.responsetext;
document.getelementbyid("result").innerhtml = result;
}
}
}
}
asp代码
<%
'-----------------------------------------------------------------
dim username
username=trim(request.form("username")) '接收ajax发送的参数
if username="" then response.end()
'------------------------------------------------------------------
set rs=server.createobject("adodb.recordset")
sql="select * from test where username = '"&username&"'"
rs.open sql,conn,1,1
'------------------------------------------------------------------
'--------如果没有找到的话,返回0
'--------如果找到的话,返回所有匹配的项目
if not (rs.eof and rs.bof) then
response.write(""&rs("time")&"")
rs.close
set rs=nothing
%>
相关文章
- DNF手游安图恩困难模式怎么打 DNF手游安图恩困难模式攻略技巧 05-17
- 崩坏星穹铁道如狼成就怎么获取 崩坏星穹铁道如狼成就获取方法 05-17
- 不思议迷宫咒灵试炼怎么过 不思议迷宫咒灵试炼攻略 05-17
- 《复体重剪版》游戏攻略 简述+配置+下载 05-17
- 《夜族崛起》无情铁制武器图纸获取攻略 05-17
- 《哈迪斯2》隐藏6个金色信物解锁方法 05-17