Foros del Web » Programando para Internet » Javascript »

decodeURIComponent

Estas en el tema de decodeURIComponent en el foro de Javascript en Foros del Web. Hola Bueno navegando por a web estaba buscando algo para codificar un string y encontré esto: Código PHP: < input id = "element_1"  name = "element_1"  ...
  #1 (permalink)  
Antiguo 25/04/2012, 09:55
 
Fecha de Ingreso: abril-2012
Mensajes: 11
Antigüedad: 12 años
Puntos: 0
decodeURIComponent

Hola

Bueno navegando por a web estaba buscando algo para codificar un string y encontré esto:

Código PHP:
<input id="element_1" name="element_1" class="element text medium" type="text" maxlength="255" onchange="check_char(false)" value="" disabled="disabled"/>

//...

function check_char(nodata)
        {
            
document.getElementById('loading').style.display "inline";
            
document.getElementById('img1').style.display "none";
            
document.getElementById('img2').style.display "none";

            var 
ajaxRequest;            
            try
            {
                
// Opera 8.0+, Firefox, Safari
                
ajaxRequest = new XMLHttpRequest();
            }
            catch (
e)
            {
                
// Internet Explorer Browsers
                
try
                {
                    
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
                }
                catch (
e)
                {
                    try
                    {
                        
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                    catch(
e)
                    {
                        return 
false;
                    }
                }
            }
            
ajaxRequest.onreadystatechange = function()
            {
                if(
ajaxRequest.readyState == 4)
                {
                    if(
ajaxRequest.responseText == 'OK ')
                    {
                        
document.getElementById('img1').style.display "inline";
                        
document.getElementById('img2').style.display "none";
                        
document.getElementById('loading').style.display "none";
                    }
                    else
                    {
                        
document.getElementById('loading').style.display "none";
                        
document.getElementById('img1').style.display "none";
                        
document.getElementById('img2').style.display "inline";
                    }
                    if(
nodata)
                        
button_click();
                }
            }
            
ajaxRequest.open("GET""check_char.php?char="+encodeURIComponent(Base64.encode(document.getElementById('element_1').value)), true);
            
ajaxRequest.send(null); 
        } 
Para verificar si existe: check_char.php?char=

Es problema mío es que no se como decodificar esto en check_char.php:
Código PHP:
encodeURIComponent(Base64.encode(document.getElementById('element_1'
Y luego hacer una consulta mysql si existe tal personaje, muestre el mensaje "OK ", y si no, "NO

Espero que me puedan ayudar, muchas gracias de antemano !

Etiquetas: formulario, mysql
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 13:12.