No se donde podra estar el error, antes siempre lo hacia asi, pero si no funciona es obvio que hay error, pero no me sale ningun tipo de error, siemplemente no hace nada.
Aqui esta la parte del HTML:
Código PHP:
<input type = "text" name = "email" id = "email" size = "50" />
<img src = "img/start.png" border = "0" alt = "Requerido" width = "15" height = "15" />
<a href = "javascript:ComprobarEmail();">Comprobar</a>
El script esta aqui:
Código PHP:
function nuevoAjax(){
var xmlhttp=false;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}
function isEmailCorrecto(email) {
var filter=/^[A-Za-z][A-Za-z0-9_]*@[A-Za-z0-9_]+.[A-Za-z0-9_.]+[A-za-z]$/;
if (email.length == 0 ) return true;
if (filter.test(email))
return true;
else
alert("Ingrese una dirección de correo válida");
return false;
}
function ComprobarEmail() {
var cEm = document.getElementById("email");
var vEm = cEm.value;
if (trim(vEm) == "") {
alert("Ingrese un correo electrónico válido.";
return false;
}
else {
if (isEmailCorrecto(vEm)) {
cEm.value = "Comprobando...";
cEm.disabled = true;
ajax = nuevoAjax();
ajax.open("GET", "../php/function.php?vEmail="+vEm, true);
ajax.onreadystatechange = function() {
if (ajax.readyState == 4) {
alert(ajax.responseText);
}
}
ajax.send(null)
}
}
}