Question: Forgive me if I word the title wrong, I'm speculating on what my problem might be as I'm not a javascript coding expert. I have a series of divs that are generated by a php loop with unique ids created by adding the unique id contained in an auto increment column in the mysql db table that contains all the info for the row. 

When the user clicks on the div this function fires off: 

```
onclick=\"showModal('".$rowInfo['ID']."_row-id')\"

```

javascript code:

```
function showModal(ID) { /* code that shows hidden modal window */ }

```

This works fine, however now I need to start adding javascript buttons (in my case img tags with onclick functions) to the div with the showModal onclick function.

I added this code to the showModal(ID) function:

```
var downArrow = document.getElementById(ID+'_down-arrow'); // Down arrow is the button users click to show addition buttons/divs
downArrow.addEventListener('click',arrowCheck,false); // checks to see if down arrow was clicked, if so arrowCheck function runs and stops propagation.

```

arrowCheck function:

```
function arrowCheck(e) { e.stopPropagation(); }

```

This bit of code also works but ONLY AFTER the user has clicked the div once, the first time the div is clicked both functions fire off (ie the modal window and the extra buttons that the down arrow shows) but after the first click the addEventListener does it's job and clicking the down arrow only shows extra buttons, elsewhere brings up the modal, etc. 

I'm guessing I need to create the event listener before the user clicks the div and fires off showModal(), is this correct? I'm not sure how to create a unique event listener for each down arrow image before the div is clicked, or even if I need to. Thanks for any help!

Answer: 
Call [FormValue](http://godoc.org/net/http#Request.FormValue) to get a query parameter:

```
token := req.FormValue("token")

```

`req` is a the `*http.Request`

An alternative is to call [ParseForm](http://godoc.org/net/http#Request.ParseForm) and access `req.Form` directly:

```
if err := req.ParseForm(); err != nil {
   // handle error
}
token := req.Form.Get("token")

```

The OP asks in a comment how to map `"token"` to `"access_token"` for an external package that's looking `"access_token"`. Execute this code before calling the external package:

```
if err := req.ParseForm(); err != nil {
   // handle error
}
req.Form["access_token"] = req.Form["token"]

```

When the external package calls `req.Form.Get("access_token")`, it will get the same value as the `"token"` parameter.
Depending on the way you want to parse the token , if its coming from the form or the URL. 

The first answer can be used if the token is being sent from the form while in case of a URL, I would suggest using this. This works for me

```
token := req.URL.Query().Get("token")

```