I have an API which I'd like to call through client-side JavaScript. I need to parse a URL parameter ref
which then needs to be passed to the API call. For example:
I visit this page www.example.com?ref=123
, JavaScript parses ref
and passes it to /api/v1.0/add?ref=123
and sends the request.
How can i do this?
Edit - Other answers show parsing the URL not making the API call.