JSFiddle - React, Tailwind, and code Playground

by CME64

HTML

<div id="takenUserName></div>

JavaScript

var data = {
        action: 'newUser',
        id:'123',
        value:'val' 
    }

     $.ajax({
        url:"http://jsfiddle.net/echo/jsonp/",
        async:false,
        crossDomain:true,
        contentType: "application/json",
        dataType: 'jsonp',
        data:data,
        // Work with the response
        success: function( response ) {
            console.log( response ); // server response

            if(response == 'invalid'){
                $('#takenUserName').html('<span style="color:red">Username already Exists</span>');
            }

        },
        error: function(xhr, status, error){
            console.log(xhr);
            console.log(status);
            console.log(error);
        }

    });