Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/06/2014, 18:09
Max_4
 
Fecha de Ingreso: mayo-2013
Ubicación: Guadalajara
Mensajes: 53
Antigüedad: 10 años, 10 meses
Puntos: 0
Respuesta del servidor me encima botones?

<script>
function followUser(a,b,btn)
{
if(window.XMLHttpRequest)
{
xmlhttp = new XMLHttpRequest();
}
xmlhttp.onreadystatechange = function()
{
if(xmlhttp.readyState == 4 && xmlhttp.status == 200)
{
btn.innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET","../followuser.php?a="+a+"&b="+b,true);
xmlhttp.send();
}
function unfollowUser(a,b,btn)
{
if(window.XMLHttpRequest)
{
xmlhttp = new XMLHttpRequest();
}
xmlhttp.onreadystatechange = function()
{
if(xmlhttp.readyState == 4 && xmlhttp.status == 200)
{
btn.innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET","../unfollowuser.php?a="+a+"&b="+b,true);
xmlhttp.send();
}
</script>

Tengo esas funciones que al insertar en la base de datos mandan con un echo, el problema es que con el innerHTML asi mismo me pone el boton de respuesta dentro del actual, alguien sabe que alternativa a inner tengo o como podria hacerlo para que lo modifique?

PD: Ya funciona poniendo un div con id y mandando el inner el div, quisiera que lo mandara al mismo boton, saludos.

<button type="button" onclick="followUser('.$a.','.$b.',this)" class="btn btn-primary" id="btn-follow">Seguir</button>