JSFiddle - React, Tailwind, and code Playground

by khalifah

JavaScript

function check_username() {
    $.ajax({
        type: "POST",
        //  dataType: 'json',
        url: "/",
        data: "via=ajax",
        success: function(msg, textStatus) {
            if (textStatus == "success") {
                alert(textStatus);
            }
        },
        error: function(jqXHR, textStatus, errorThrown) {
            console.log(textStatus);
            if (textStatus == "parsererror") {
                alert("There is an error in your JSON object");
            }
        }
    });
}
$(document).ready(function() {
    check_username();
});