JSFiddle - React, Tailwind, and code Playground

by richbuff

HTML

<label for='idfname'>First Name:</label>
<input type='text' id='idfname' />
<br/>
<label for='idlname'>Last Name:</label>
<input type='text' id='idlname' />
<br/>
<button id='btntoclick' onclick='handleClick();'>Click me</button>
<br/>
<div id='results' />

JavaScript

$().ready(function () {
    $('#btntoclick').click(function () {
        var url = 'http://fineglasswork.com/histmarkers/client/partial.php';

        $.ajax({
            type: 'GET',
            url: url,
            contentType: "application/json",
            dataType: 'jsonp',
            data: {
                first: $("#idfname").val(),
                last: $("#idlname").val()
            },
            crossDomain: true,
            success: function (res) {
                $("#results").html("Hello, " + res.firstname + " " + res.lastname);
                console.dir(res.fullname);
            },
            error: function (e) {
                console.log(e.message);
            },
            complete: function (data) {
                console.log(e.message);
            }
        });
    });
});