jquery 传值到asp
页面A。html
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
function cDiv(id)
{
$.post("site.asp?action"+id,function(data)
{
alert(data);
}
);
}
</script>
</head>
<body>
<a href="javascript:void(0)" onclick="cDiv(5450)">aaaaaaaaaaaa</a>
//X这样传至可以
<a href="site.asp?action=5450">aaaaaaaaaaaa</a>
</body>
</html>
site.asp页面
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
dim conn,connstr,db,str,SqlDatabaseName,SqlPassword,SqlUsername,SqlLocalName
action=Request.QueryString("action")
set conn=Server.CreateObject("ADODB.CONNECTION")
SqlDatabaseName = "xm" 'SQL数据库名
SqlPassword = "123" 'SQL数据库用户密码
SqlUsername = "xm" 'SQL数据库用户名
SqlLocalName = "(local)" 'SQL主机IP地址(本地可用"127.0.0.1"或"(local)",非本机请用真实IP)P)
connstr = "Provider = Sqloledb; User ID = " & SqlUsername & "; Password = " & SqlPassword & "; Initial Catalog = " & SqlDatabaseName & "; Data Source = " & SqlLocalName & ";"
conn.open connstr
set rs=server.CreateObject("adodb.recordset")
sqlstr="select * from [product] where id="&action
rs.open sqlstr,conn,1,3
rs.movefirst
while not rs.eof
str=str+cstr(rs("id"))+"囃"+rs("size")+"囃"+rs("Memo")+"囃"+rs("color")+"囃"+rs("DefaultPicUrl")+"囃"+cstr(rs("z_l"))+"彟"
rs.movenext
wend
rs.close
conn.close
set rs=nothing
set conn=nothing
Response.Charset="UTF-8"
Response.Write(str)
%>
求大神帮看下。我用$.post("site.asp?action"+id,function(data) 或者get传值都得不到返回值data