Desde el punto de vista de la seguridad, ¿cuándo debo usar encodeURIComponent o encodeURI y cuándo no necesito usarlo?
¿Necesito usar encodeURI en "https://nominatim.openstreetmap.org/search.php?q="
como se muestra a continuación?
¿Necesito encodeURIComponent cada clave en la cadena de consulta, como polygon_geojson
y format
?
And do I need to use them on only GET or also on POST method? On another posted question, there were mixed answers. $.get( "https://nominatim.openstreetmap.org/search.php?q=" + encodeURIComponent(query) + "&polygon_geojson=1&format=jsonv2", function (response) { if (response.length > 0) { var latlng = new L.LatLng(response[0].lat, response[0].lon); marker.setLatLng(latlng); map.panTo(latlng); acadp_update_latlng(response[0].lat, response[0].lon); } }, "json" );