JSFiddle - React, Tailwind, and code Playground
HTML
<FORM action="auction_time_var.js" method="post" id="adminForm">
<P>
<LABEL for="name">Name:</LABEL>
<INPUT type="text" name="firstname">
<BR>
<LABEL for="price">Price:</LABEL>
<INPUT type="text" name="lastname">
<BR>
<LABEL for="dueTime">Due Time:</LABEL>
<INPUT type="text" name="email">
<BR>
<LABEL for="location">Location:</LABEL>
<INPUT type="text" name="location">
<BR>
<LABEL for="urlPhoto">Photo url:</LABEL>
<INPUT type="text" name="photo_url">
<BR>
<LABEL for="description">Description:</LABEL>
<br>
<textarea rows="4" cols="50" name="comment">Enter text here...</textarea>
<INPUT type='button' onclick='getVariables()' value="Send" />
</P>
</FORM>
JavaScript
function getVariables() {
var formObj = $('#adminForm').serializeObject();
console.log(formObj);
}
$.fn.serializeObject = function()
{
var o = {};
var a = this.serializeArray();
$.each(a, function() {
console.log(a.value);
if (o[this.name] !== undefined) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
} else {
o[this.name] = this.value || '';
}
});
return o;
};