ajax问题 帮忙看下

cqsjchh1987 2010-01-26 01:47:16
function upnum(h_id){

var url = "InfoOnOff.asp?ID="+ h_id
var ajax = InitAjax();
ajax.open("GET", url, true);
ajax.onreadystatechange = function() {

if (ajax.readyState == 4 && ajax.status == 200) {
alert(h_id);
}

}
ajax.send(null);
}

这是js代码

ID = Request.QueryString ("ID")


StrSQL="Update WebInfo Set Is_Commend=0 Where ID="&ID
DbConn.Execute StrSQL

DbConn.Close
Set DbConn=Nothing

这是asp代码


<input type="checkbox" id="Is_Commend" name="Is_Commend" onClick="upnum(<%=Rs("ID")%>)">

这样写 是否正确 为什么我点击之后 数据库中的数据还是没有改变
...全文
86 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
来者 2010-01-27
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 cqsjchh1987 的回复:]
我晕死 ie7  里不行 但firefox却行
[/Quote]
firefox 和IE 的xmlhttpRequest创建对象不一样的
gxq323 2010-01-26
  • 打赏
  • 举报
回复
StrSQL="Update WebInfo Set Is_Commend=0 Where ID="&ID
DbConn.Execute StrSQL
单独赋值执行下它试试
cqsjchh1987 2010-01-26
  • 打赏
  • 举报
回复
为什么 在 ie7中 alert(ajax.responsetext) 能打印用response.write 输出的结果 但就是修改不了数据库

但在ff中就行
cqsjchh1987 2010-01-26
  • 打赏
  • 举报
回复
我晕死 ie7 里不行 但firefox却行
gxq323 2010-01-26
  • 打赏
  • 举报
回复
再打印ID= Request.QueryString ("ID")
看看
jackzhangyunjie 2010-01-26
  • 打赏
  • 举报
回复
刚写的一个例子,你看一下:
http://blog.csdn.net/jackzhangyunjie/archive/2010/01/26/5256560.aspx
gxq323 2010-01-26
  • 打赏
  • 举报
回复
h_id 也是正确的吗?
cqsjchh1987 2010-01-26
  • 打赏
  • 举报
回复
加上 window.location.href=url 页面却能跳过去的
cqsjchh1987 2010-01-26
  • 打赏
  • 举报
回复
能返回这个url的啊
gxq323 2010-01-26
  • 打赏
  • 举报
回复
慢慢调试了
function upnum(h_id){

var url = "InfoOnOff.asp?ID="+ h_id
alert(url);//看看获取到值了没有
var ajax = InitAjax();
ajax.open("GET", url, true);
ajax.onreadystatechange = function() {

if (ajax.readyState == 4 && ajax.status == 200) {
alert(h_id);
}

}
ajax.send(null);
}

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧