JSFiddle - React, Tailwind, and code Playground

by Emily Humphrey

HTML

<form id="widget_contact" action="http://hmphry.com/w/sp-form/send.php" method="post">
    <div id="packages">
        <input type="radio" name="package" value="2">2 Hours
        <input type="radio" name="package" value="3">3 Hours
        <input type="radio" name="package" value="4">4 Hours
    </div>
    <input type="text" name="name" id="c_name" /></br>
    <input type="hidden" name="hdnCmd" value="sb-gimme" />
    <input name="send_button" id="fc_submit" class="btn_b" type="submit" value="Gimme" />
</form>

JavaScript

$('#widget_contact').submit(function(e){
    e.preventDefault();
    var form = $(this);
    
    $.ajax({
        url: form.prop('action'),
        method: form.prop('method'),
        data: $('#widget_contact').serialize(),
        success: function(){
            alert('Hurraaaayyy');
        }
    });
    
});