Answer the question
In order to leave comments, you need to log in
How to read data from a link into a form?
Hello!
Can you please tell me how can I read the data from the link into the form?
Links like this:
site .com/signup?email=user%40mail.com&phone=380989035745&date=19911225&offer=1&lang=ua&country=ua
Answer the question
In order to leave comments, you need to log in
If IE is not needed, then you can use URLSearchParams
let url = 'email=user%40mail.com&phone=380989035745&date=19911225&offer=1&lang=ua&country=ua'
console.log([...new URLSearchParams(url).entries()].reduce((query, [key, value]) => Object.assign(query, {[key]: value}), {}))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question