Ajax Double Call
Posted
by
Lordareon
on Stack Overflow
See other posts from Stack Overflow
or by Lordareon
Published on 2011-01-12T05:29:41Z
Indexed on
2011/01/12
5:53 UTC
Read the original article
Hit count: 172
with this function
<script type="text/javascript">
function ajaxcall(div, page)
{
if (window.XMLHttpRequest)
{xmlhttp=new XMLHttpRequest();}
else
{ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById(div).innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET",page,true);
xmlhttp.send();
}
</script>
i use my ajax. But in the page i call 2 times this function:
<script type="text/javascript">ajaxcall("menu", "perfil.php");</script>
<script type="text/javascript">ajaxcall('mapadiv', "map2.php");</script>
But happens that only one of them works, if i remove one the other works. What im doing wrong? Thanks!
© Stack Overflow or respective owner