JSFiddle - React, Tailwind, and code Playground
HTML
<form id="form_id" action="/echo/html/" method="POST">
<label for="location">Location</label>
<input class="form_field_input" type="text" name="new_loc_loc_name" id="new_loc_loc_name" />
<input type="button" value="Create" id="new_loc_add" />
</td>
</form>
CSS
input, label, button {
display: block;
}
JavaScript
$(document).ready(function (event) {
event.preventDefault();
$('#new_loc_add').click(function () {
var url = $("#form_id").attr('action');
$.post(url, $("form#form_id").serialize());
});
});