3个回答
2013-12-04
展开全部
给个例子你去看看,应该就明白了 var http_request=false; function initXMLHttpRequest(){ if(window.XMLHttpRequest){
http_request=new XMLHttpRequest();
if(http_request.overrideMineType){
http_request.overrideMineType("text/xml");
}
}
else if(window.ActiveXObject){
try{
http_request=new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
http_request=new ActiveXObject("Microsoft.XMLHTTP");
}
}
}
function yewuOnchange(id){
var Num=document.getElementById("Num").value;
initXMLHttpRequest(); http_request.onreadystatechange=callBackByyewu; http_request.open("post","/AJAXControl?actionflag=yewu&busi_code="+id+"&&Num="+Num,true);
http_request.send(null);
} function callBackByyewu(){
var Num=document.getElementById("Num").value; if(http_request.readyState==4){
if(http_request.status==200){ var cjgsdata=document.getElementById("cjgsdata"+Num+"");
cjgsdata.innerHTML=http_request.responseText;
}else{
alert("AJAX出错了!");
}
}
}
http_request=new XMLHttpRequest();
if(http_request.overrideMineType){
http_request.overrideMineType("text/xml");
}
}
else if(window.ActiveXObject){
try{
http_request=new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
http_request=new ActiveXObject("Microsoft.XMLHTTP");
}
}
}
function yewuOnchange(id){
var Num=document.getElementById("Num").value;
initXMLHttpRequest(); http_request.onreadystatechange=callBackByyewu; http_request.open("post","/AJAXControl?actionflag=yewu&busi_code="+id+"&&Num="+Num,true);
http_request.send(null);
} function callBackByyewu(){
var Num=document.getElementById("Num").value; if(http_request.readyState==4){
if(http_request.status==200){ var cjgsdata=document.getElementById("cjgsdata"+Num+"");
cjgsdata.innerHTML=http_request.responseText;
}else{
alert("AJAX出错了!");
}
}
}
2013-12-04
展开全部
Ajax就是实现局部刷新的效果的嘛
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-12-04
展开全部
按HTML 页面控件的写法!返回数据到页面就可以了啊
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询