JSFiddle - React, Tailwind, and code Playground

by Neo Aptt

HTML

<button class='clickable' data-href='page.php'>URL One</button>
<button class='clickable' data-href='otherpage.php'>URL Two</button>
<input name='color' class='data' value='black'/>
<input name='color2' class='data' value='yellow'/>
<div class='text-center' id='container'></div>

JavaScript

$('.clickable').click(function () {
    var href = $(this).data('href');
    var data = $('.data').serialize();
/*
post doesn't work with JSFiddle. 
Need to test this on live site.

    $.post(href, data, function (html) {
        $('#container').html(html);
    });
*/
    $('#container').html(data);
});