Ver Mensaje Individual
  #2 (permalink)  
Antiguo 09/09/2015, 17:10
sonystar_17
 
Fecha de Ingreso: septiembre-2015
Mensajes: 142
Antigüedad: 8 años, 8 meses
Puntos: 13
Respuesta: Duda sobre ajax , jquery

Código:
<html>
<head>
<script>
function showUser(str) {
    if (str == "") {
        document.getElementById("txtHint").innerHTML = "";
        return;
    } else { 
        if (window.XMLHttpRequest) {
            // code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp = new XMLHttpRequest();
        } else {
            // code for IE6, IE5
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange = function() {
            if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                document.getElementById("txtHint").innerHTML = xmlhttp.responseText;
            }
        }
        xmlhttp.open("GET","getuser.php?q="+str,true);
        xmlhttp.send();
    }
}
</script>
</head>
<body>

<form>
<button type="button" value="1" onclick="showCustomer(this.value)">1</button>

<button type="button" value="2" onclick="showCustomer(this.value)">2</button>




</form>
<br>
<div id="txtHint"><b>Person info will be listed here...</b></div>




</body>
</html>

disculpen por no poner código antes ,no estaba en mi PC
mi pregunta es esta :

ya tengo una función llamada showCustomer
como pueden notar tengo 2 botones yo quiero cargar una lista con el primer boton.
que no tiene relación con la segunda.
y ya luego al apretar el otro boton quiero cargar la otra lista ( una no depende de la otra son independientes )


mi pregunta es : tengo que crear otra función showCustomer igual pero con otro nombre ?

o puedo hacerla con esa misma función.