Wondering is there a function in javascript without jquery or any framework that allows me to serialize the form and access the serialize version?
相关问题
- Is there a limit to how many levels you can nest i
- Laravel Option Select - Default Issue
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
Here's a slightly modified version of TibTibs':
Disabled fields are discarded and names are also URL encoded. Regex replace of %20 characters takes place only once, before returning the string.
The query string is in identical form to the result from jQuery's $.serialize() method.
If you are looking to serialize the inputs on an event. Here's a pure JavaScript approach I use.
Data will be a JavaScript object of the inputs.
I could be crazy but I'm finding these answers seriously bloated. Here's my solution
To use like this:
I hope I have helped.
For debugging purposes this might help you: