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 的内容 求解
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 的内容 求解
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;