编程论坛's Archiver

xbdeig 发表于 2007-1-13 20:04

[求助]xmlhttp.send 问题

   function ajaxSendPost(url, values, processRequest) {<BR>    ajaxHttpRequest.open("POST",url, true)<BR>    ajaxHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");<BR>    ajaxHttpRequest.send(values);<BR>    ajaxHttpRequest.onreadystatechange = processRequest;<BR>}<BR>function Button1_onclick() {<BR>ajaxInit()<BR>    ajaxSendPost("ajaxchat.aspx", "username=name", box);<BR>}<BR><BR>为什么执行过后,Request["username"] 取不到值呀?<BR><BR>我所有代码都是在这页面执行的,ajaxchat.aspx

icecool 发表于 2007-1-13 22:38

ajaxSendPost("ajaxchat.aspx", "<FONT color=#f70909>username=name</FONT>", box);<BR><BR>这里为何是这个样子呢?<BR>

xbdeig 发表于 2007-1-14 11:04

Request["username"] 值 就是name 呀<BR>现在问题是值接受不到呀,先不管传的什么值了

xbdeig 发表于 2007-1-14 16:59

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

xbdeig 发表于 2007-1-14 18:23

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

nightheart 发表于 2007-1-24 08:48

...楼主的SERVER是什么??

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.