JSFiddle - React, Tailwind, and code Playground

HTML

<form onsubmit="return forSubmit(this)">
<input type="text" name='abc' />
<input type="submit" name="submit" />
</form>

<div id="output">
Output : 
</div>

JavaScript

function forSubmit(form){
var result = {};
$.each($(form).serializeArray(), function() {
    result[this.name] = this.value;
});

     $.ajax({
                    type:'POST',
                    dataType: "json",
                    url:'/echo/json/',
                    data:{
            json:JSON.stringify(result)
        },
                   success : function(output){
                  
                     $('#output').append(JSON.stringify(output));
                    }
                });

  return false; //don't submit
}