Edit on
<button type="button" class="btn btn-info" onclick='tradableEmbed.authenticateWithWindow()'>Enable trading</button>
<span id="result"></span>
body {
  font-size: 22px;
  background: #F0F0F0;
  margin: 20px;
}
$ = trEmbJQ; // Assign jQuery back to $

function getAndShowAccounts() { // Initialize and show accounts
    tradableEmbed.getAccounts().then(
        function() { // Success
            printResult(tradableEmbed.accounts);
        },
        function(jqXHR, message, error) { // Error
            printResult(jqXHR);
        }
    );
}

tradableEmbed.onEmbedReady(function () {
    if(tradableEmbed.tradingEnabled) {
        $(".btn").hide();
        getAndShowAccounts();
    }
});

function printResult(obj) {
    var preTag = "<pre class='prettyprint'>", preClose = "</pre>";
    $("#result").html(preTag + JSON.stringify(obj, null, 2) + preClose);
    PR.prettyPrint();
}
Rerun