ajax代码 
Ajax2:function(url,value,getorpost,callback){
getorpost = getorpost.toLowerCase();
var doc=Rayyu.Load.AjaxDom();
if (doc==null){
return null;
}
doc.onreadystatechange=function(){
if (doc.readyState==4){
try{
if(callback && typeof(callback)=="function"){
callback(doc.status,doc.responseText,doc.responseXML);
}
}catch(e){}
}
};
doc.open(getorpost,url,true);
//doc.setRequestHeader("Accept", "*/*");
doc.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
if(getorpost=="post"){
//doc.setRequestHeader("Content-Length",value.length);
//doc.setRequestHeader("Accept-Charset","GB2312,utf-8;q=0.7,*;q=0.7");
doc.send(value);
$("bbb").innerHTML=value.length + "|" +value;
}
else{
doc.send(null);
}
return doc;
}后台有收到请求,但没数据 如 Ajax("/VideoList.Rayyu","a=b&page=" + encodeURIComponent( new Date().toString()),"post",function ……后台得到http请求为POST /VideoList.Rayyu HTTP/1.1
Host: 127.0.0.1:10001
Connection: keep-alive
Referer: http://127.0.0.1:10001/Index.Rayyu?a=2011%2f5%2f22+12%3a08%3a08
Content-Length: 86
Origin: http://127.0.0.1:10001
User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.68 Safari/534.24
Content-Type: application/x-www-form-urlencoded
Accept: */*
Accept-Encoding: gzip,deflate,sdch
Accept-Language: zh-CN,zh;q=0.8
Accept-Charset: GBK,utf-8;q=0.7,*;q=0.3
但是没有content 的内容  求解

解决方案 »

  1.   

    有一点要补充,firefox下 post值存在ie和chrome下 大部分丢失 偶尔存在
      

  2.   


    Ajax2:function(url,value,getorpost,callback){
                getorpost = getorpost.toLowerCase();
                var doc=Rayyu.Load.AjaxDom();            
                if (doc==null){  return null; }             doc.open(getorpost,url,true);   
                doc.onreadystatechange=function(){                
                    if (doc.readyState==4&&(doc.status==200||doc.staatus==0)){
                        try{
                            if(callback && typeof(callback)=="function"){
                                callback(doc.status,doc.responseText,doc.responseXML);
                            }
                        }catch(e){}                    
                    }
                };
                 
                if(getorpost=="post"){
                    doc.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
                    //doc.setRequestHeader("Content-Length",value.length);
                    //doc.setRequestHeader("Accept-Charset","GB2312,utf-8;q=0.7,*;q=0.7");
                    doc.send(value);
                    $("bbb").innerHTML=value.length + "|" +value;
                }
                else{
                    doc.send(null);
                }            
                return doc;
            
      

  3.   

    doc.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");写哪里应该不是这问题 get正常  只是post异常
      

  4.   

    doc.status==200||doc.staatus==0  这个无关痛痒把  直接把status值返回给回调函数 
      

  5.   

    自行解决,散分 谢谢楼上2位,js没有任何问题,我是用socket模拟 iis ,问题出在 socket上,post有时候是发2个包了 要获取 呵呵