Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Calculadora

0

40
Vistas
When to use and when not to use encodeURIComponent or encodeURI?

In a security standpoint, when should I use encodeURIComponent or encodeURI and when I don't need to use it?

Do I need to use encodeURI on "https://nominatim.openstreetmap.org/search.php?q=" as shown below?

Do I need to encodeURIComponent each key in the query string, like polygon_geojson and 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"
);
7 months ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos