Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

134
Vistas
Matching exact values of parameter from URL using JavaScript

Hello friends i have website url ="https://www.example/en_uk/cgid=ladywears&middle=20&end=100" I need to extract the value of parameter "middle" and "end" which can be any numeric value from 10 to 10000. Have 1 condition which need to fulfilled -- Url will be passed dynamically and the program should only run if it has exact "middle" and "end" word matching in it .Need help in writing it in JavaScript .

Thanks in advance

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can use URLSearchParams to parse the params.

In your real environment, you must use var url = window.location.search; to get the current URL. In the below example, I just use your provided URL instead of window.location.search;.

// Use window.location.search in your live environment
// var url = window.location.search;

var url = "https://www.example/en_uk/cgid=ladywears&middle=20&end=100";
const urlParams = new URLSearchParams(url);
const middle = urlParams.get('middle');
const end = urlParams.get('end');

console.log('middle', middle);
console.log('end', end);

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda