Hi, my name is Austin Gil.
I'm a web developer from Portland, Oregon.
Over the last ten years, I’ve built projects for award-winning agencies, innovative start-ups, government organizations, and more.
Oh yeah, that would make sense. I usually give each checkbox its own name, and if they are related, I put them inside a <fieldset>. I'll need to remember this if I'm working with objects and want a list.
Usually I just wrap the data in a URLSearchParams and send it to the backend like that. URLSearchParams will handle the list if there are multiple entries with the same name.
Hi, my name is Austin Gil.
I'm a web developer from Portland, Oregon.
Over the last ten years, I’ve built projects for award-winning agencies, innovative start-ups, government organizations, and more.
Ah yes. This is true. My only issue with this is using FormData in the request body changes the request headers from the default application/x-www-form-urlencoded to multipart/form-data. This has caused me issues before, so I try to avoid it.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Oh yeah, that would make sense. I usually give each checkbox its own name, and if they are related, I put them inside a
<fieldset>
. I'll need to remember this if I'm working with objects and want a list.Usually I just wrap the data in a
URLSearchParams
and send it to the backend like that.URLSearchParams
will handle the list if there are multiple entries with the same name.If you POST, I believe you can do directly
body: new FormData(e.target)
if you GET and adjoin a query string, you may indeed need URLSearchParams
Ah yes. This is true. My only issue with this is using FormData in the request body changes the request headers from the default
application/x-www-form-urlencoded
tomultipart/form-data
. This has caused me issues before, so I try to avoid it.