Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/10/2009, 10:59
eurodoblon
 
Fecha de Ingreso: enero-2008
Mensajes: 303
Antigüedad: 16 años, 3 meses
Puntos: 0
ajax api recaptcha

Hola:
Al implementar recapatcha con ajax, llamando a la funcion verificar, siempre me da respuesta null el servidor recaptcha.
Segun he leido es porque las peticiones han de hacerse con XMLHttpRequest (publica), pero no tengo mucha idea de ajax y no se como hacerlo
¿podeís ayudarme?
Gracias y un saludo

Código HTML:
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 showRecaptcha(element) {
          Recaptcha.create("6LcnqQ..................dwqXxLNg9", element, {
          theme : 'custom',
			lang: 'es',
            callback: Recaptcha.focus_response_field});
        }

  function verificar(date,res) {

if (!res) {
res = 'FAIL';
}
if(res== "true") {
document.getElementById('formulario').submit();
} else {


alert('Captcha not correct, please try again');

}
}

     </script>