I'm trying to send a parameter by url from javascript, and that parameter has accents. I try to encode to utf8 and then I code the url but apparently, it does not do it as it should (excuse foolishness but avoiding tildes is not an option).
echo "<script>";
echo "$(document).ready(function(){";
echo "$('#filtrobusqueda').on('keyup', function() {";
echo "var palabra = document.getElementById('buscarpalabra').value;";
//echo "palabra = utf8_encode(palabra);"
//echo "palabra = encodeURI(palabra)";
$dato = "palabra";
echo "$('#mostrar').load('mostrar.php?parametro='+". (urldecode(utf8_encode($dato))).");";
echo "});";
echo "});";
echo "</script>";
I already tried with those who are commented and does not do anything; I tried to code with the functions of php (urldecode and utf8_encode) but it does not recognize it either.
How could I solve it without having to remove the accents with another function?