JSFiddle - React, Tailwind, and code Playground

by johnhunter

HTML

<div id="wrap">
    <div id="header">
        
    </div>
    <div id="content">
        <form method="POST" action="code.php"> 
            Name:
            <input type="text" name="name" size="50">
            <input type=submit value="Get Code">
        </form> 
    </div>
    <div id="footer">
        
    </div>

JavaScript

$(function() {

    $('form').submit(function() {

        // create an object to send as a post
        var form = this,
            fields = form.elements,
            post = {};


        for (var i in fields) {
            if (fields[i].name) post[fields[i].name] = fields[i].value;
        }

        // send the form data in the load request...
        $('#content').load(this.action, post);
        return false;
    });

});