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);
}
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')
Espero que me puedan ayudar, muchas gracias de antemano !