JSFiddle - React, Tailwind, and code Playground

by Oski Krawczyk

HTML

<form id="the-form" action="/ajax_json_echo/" method="post">
    First name: <input type='text' name='first_name' value='' /><br/>
    Last name: <input type='text' name='last_name' value='' /><br/>
    <input type='checkbox' name='category[]' value='Math' /> Math<br/>
    <input type='checkbox' name='category[]' value='Science' /> Science<br/>
    <input type='checkbox' name='category[]' value='History' /> History<br/>
    
    </form>

JavaScript

var theForm = $('the-form');

new Request.JSON({
    url: '/ajax_json_echo/',
    onSuccess: function(){
        alert('success');
    }
}).post(theForm.toQueryString());