JSFiddle - React, Tailwind, and code Playground

by bluey

HTML

<form id="myForm">
    Title:   <input name="title" /><br>
    Content: <input name="content" />
</form>
<button id="postBtn">Post</button><br>

<br>
<div id="paramsSent"\>
<div id="return" \>

JavaScript

var count = 0;

$('#postBtn').click(function() {

   
    if count == 0 {
        
    var str = $('#myForm').serialize();
    $('#paramsSent').html(str);
    
    $.post('yourPostPath',
          str,
          function(data){
              $('#return').html(data);
       
           
          count = 1;    
          });
    
    }
    
 });