2dan
03-27-2010, 09:57 PM
I have some ajax code which is refreshing a div of mine, however when it refreshes the div it places my index page inside that div, I know why but I don't know how to simply make it refresh that div without placing the index page inside it?
function Ajax(){
var xmlHttp;
try{
xmlHttp=new XMLHttpRequest();
}catch (e){
try{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}catch (e){
try{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}catch (e){
alert("error");
return false;
}
}
}
xmlHttp.onreadystatechange=function(){
document.getElementById('refreshed_div').innerHTML=xmlHttp.responseText;
setTimeout('Ajax()',1000);
}
xmlHttp.open("GET","index.html",true);
xmlHttp.send(null);
}
window.onload=function(){
setTimeout('Ajax()',1000);
}
I don't know what I need to place where is says
xmlHttp.open("GET","index.html",true);
so that it displays the information within the div when its refreshed rather then the index page
any help would be greatly appreciated!
function Ajax(){
var xmlHttp;
try{
xmlHttp=new XMLHttpRequest();
}catch (e){
try{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}catch (e){
try{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}catch (e){
alert("error");
return false;
}
}
}
xmlHttp.onreadystatechange=function(){
document.getElementById('refreshed_div').innerHTML=xmlHttp.responseText;
setTimeout('Ajax()',1000);
}
xmlHttp.open("GET","index.html",true);
xmlHttp.send(null);
}
window.onload=function(){
setTimeout('Ajax()',1000);
}
I don't know what I need to place where is says
xmlHttp.open("GET","index.html",true);
so that it displays the information within the div when its refreshed rather then the index page
any help would be greatly appreciated!