学习型 ASP/PHP/ASP.NET 主机 30元/年全能 ASP/PHP/ASP.NET 主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付
发新话题
打印

[求助]xmlhttp.send 问题

[求助]xmlhttp.send 问题

function ajaxSendPost(url, values, processRequest) {
ajaxHttpRequest.open("POST",url, true)
ajaxHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
ajaxHttpRequest.send(values);
ajaxHttpRequest.onreadystatechange = processRequest;
}
function Button1_onclick() {
ajaxInit()
ajaxSendPost("ajaxchat.aspx", "username=name", box);
}

为什么执行过后,Request["username"] 取不到值呀?

我所有代码都是在这页面执行的,ajaxchat.aspx

TOP

ajaxSendPost("ajaxchat.aspx", "username=name", box);

这里为何是这个样子呢?
loading...

TOP

Request["username"] 值 就是name 呀
现在问题是值接受不到呀,先不管传的什么值了
授人以鱼不如授人以渔

TOP

<script type="text/javascript">
var ajaxHttpRequest = false;

function ajaxInit() {
if(window.XMLHttpRequest) { //Mozilla, Opera, ...
ajaxHttpRequest = new XMLHttpRequest();
if(ajaxHttpRequest.overrideMimeType) {
ajaxHttpRequest.overrideMimeType("text/xml");
}
}
else if(window.ActiveXObject) { //IE
try{
ajaxHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
try{
ajaxHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e) {
}
}
}
if(!ajaxHttpRequest) {
alert("不能创建XMLHttpRequest对象实例");
return false;
}
else{alert("创建XMLHttpRequest对象实例");}
}
function ajaxSendPost(url, values, processRequest) {
ajaxHttpRequest.open("POST",url, true)
ajaxHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
ajaxHttpRequest.send(values);
ajaxHttpRequest.onreadystatechange = processRequest;
}
function Button1_onclick() {
ajaxInit()
ajaxSendPost("ajaxchat.aspx?username=aa","null", box);
}
function box(){
if(ajaxHttpRequest.readyState==4) {
if(ajaxHttpRequest.status==200) {
alert('Msg');
}
}
}
</script>
然后我在本页面代码里写 Response.Write(Request["username"]);
为什么什么都没有呀?Request["username"]根本没值
我新学ajax,帮帮我!

授人以鱼不如授人以渔

TOP

获取到了,呵~不知道为什么。开心..

授人以鱼不如授人以渔

TOP

...楼主的SERVER是什么??
欢迎到我的小站http://www.dewsong.net指导。

TOP

发新话题