Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

130
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!