[求助]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 ajaxSendPost("ajaxchat.aspx", "<FONT color=#f70909>username=name</FONT>", box);<BR><BR>这里为何是这个样子呢?<BR> Request["username"] 值 就是name 呀<BR>现在问题是值接受不到呀,先不管传的什么值了 <P> <script type="text/javascript"><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> </script> <BR>然后我在本页面代码里写 Response.Write(Request["username"]);<BR>为什么什么都没有呀?Request["username"]根本没值<BR>我新学ajax,帮帮我!</P> <P>获取到了,呵~不知道为什么。开心..</P> ...楼主的SERVER是什么??
页:
[1]
