A
Arjen
Hi,
I want to reload 2 divs at one click. Ive tried:
<a href = "javascript:void(0);"
onclick="show('ajaxrequest.php?action=removefield','div1');show('ajaxrequest.php?action=reloaddiv2','div2')">verwijderen</a>
While both seperate actions work they dont when I put them together.
Anyone know how to fix this ?
My ajax.js with funcition show
var xmlHttp
var mydiv
function show(str,div)
{
mydiv=div;
if (str.length==0)
{
document.getElementById(mydiv).innerHTML=""
return
}
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var url=""
url=url+str
url=url+"&rnd="+Math.random()
xmlHttp.onreadystatechange=stateChanged()
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
document.getElementById('loading').innerHTML="";
document.getElementById(mydiv).innerHTML=xmlHttp.responseText
}
else
{
document.getElementById('loading').innerHTML="<h1>Loading ....
</h1><img src = '/fw/images/loading.gif'>";
}
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
I want to reload 2 divs at one click. Ive tried:
<a href = "javascript:void(0);"
onclick="show('ajaxrequest.php?action=removefield','div1');show('ajaxrequest.php?action=reloaddiv2','div2')">verwijderen</a>
While both seperate actions work they dont when I put them together.
Anyone know how to fix this ?
My ajax.js with funcition show
var xmlHttp
var mydiv
function show(str,div)
{
mydiv=div;
if (str.length==0)
{
document.getElementById(mydiv).innerHTML=""
return
}
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var url=""
url=url+str
url=url+"&rnd="+Math.random()
xmlHttp.onreadystatechange=stateChanged()
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
document.getElementById('loading').innerHTML="";
document.getElementById(mydiv).innerHTML=xmlHttp.responseText
}
else
{
document.getElementById('loading').innerHTML="<h1>Loading ....
</h1><img src = '/fw/images/loading.gif'>";
}
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}