JSFiddle - React, Tailwind, and code Playground

JavaScript

function onDeviceReady() {
    if (function1()){
        if (getDBsettings()){
            if (function3()){
                dostuff;
            }
            else{
                alert("");
            }
        }
        else{
           alert(""); 
        }                     
    }
    else{                    
       alert(""); 
    }
}



function getDBsettings(){
    var xmlhttp= new XMLHttpRequest();
    xmlhttp.open("POST","http://abcdefgh.php", false);
    xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
    xmlhttp.onload = function(){
        if(xmlhttp.status == 200){
            var json_string = xmlhttp.responseText;
            var json = JSON.parse(json_string);
            if(json.success===1){
                return true;
            }
            else{
                return false;
            }
        }
        else if(xmlhttp.status == 404){
            return false;
        }
        else{
            return false;
        }
    };
    xmlhttp.send();
}