ajax 怎么实现无限动态添加控件
- 提问者网友:心牵心
- 2021-08-14 15:10
- 五星知识达人网友:躲不过心动
- 2021-08-14 16:15
给个例子你去看看,应该就明白了
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出错了!");
}
}
}
- 1楼网友:傲气稳了全场
- 2021-08-14 17:07
- 2楼网友:持酒劝斜阳
- 2021-08-14 16:47
按HTML 页面控件的写法!返回数据到页面就可以了啊