JSFiddle - React, Tailwind, and code Playground

JavaScript

function validateCustomerForm() {

    var postUrl = '/echo/json/'
    var postData = { 'customer': 'coolio' };

    return $.post(postUrl, postData); // return promise object
}

// usage
validateCustomerForm().done(function(response) { // resolve promise
    console.log(response) // call has returned and we can execute logic here
});