szsoho 2009-07-22 14:05
浏览 289
已采纳

xmlhttp.responseText 空出错

var xmlhttp;
try{
xmlhttp=new XMLHttpRequest();
}catch(e){
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
//打开连接,true表示异步提交
xmlhttp.open("post", "ajax_careerwill.asp", true);
//当方法为post时需要如下设置http头
xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
//发送数据
xmlhttp.send("d_id="+escape(nl_ve_id)+"&d_ganwei="+escape(nl_ve_gw)+"&d_diqu="+escape(nl_ve_dq)+"&d_zhuf="+escape(nl_ve_zf)+"&d_jobtype="+escape(nl_ve_lx)+"&d_yuexin="+escape(nl_ve_yx)+"&d_beizhu="+escape(nl_ve_bz))

var x=unescape(xmlhttp.responseText);

[b]问题补充:[/b]
加了是不出错,但是
alert()没有出来
[b]问题补充:[/b]
先用提交表单测试过了,服务肯定有返回值,这得不到.
//创建XMLHttpRequest对象
var xmlhttp;
try{
xmlhttp=new XMLHttpRequest();
}catch(e){
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
//打开连接,true表示异步提交
xmlhttp.open("post", "ajax_careerwill.asp", true);
//当方法为post时需要如下设置http头
xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
//发送数据
xmlhttp.send("d_id="+escape(nl_ve_id)+"&d_ganwei="+escape(nl_ve_gw)+"&d_diqu="+escape(nl_ve_dq)+"&d_zhuf="+escape(nl_ve_zf)+"&d_jobtype="+escape(nl_ve_lx)+"&d_yuexin="+escape(nl_ve_yx)+"&d_beizhu="+escape(nl_ve_bz))
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {

document.write(xmlhttp.responseText);

}

[b]问题补充:[/b]
加了http_request.onreadystatechange = alertContents;
出错
asp处页面是输入出一个id,没有问题.

不明白
谢谢

  • 写回答

5条回答 默认 最新

  • pjuneye 2009-07-22 15:55
    关注

    有莫子不明白的. 好好研究下我给你的第一个帖子吧.
    手写AJax就那么几步,踩着步子走就OK了.
    如果想好好学习下,有本书<>,很好的.
    希望LZ有进步. :idea:

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题