JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<button id="btn">
Valor
</button>
<button id="btnSetar">
Setar
</button>
JavaScript
var nome_da_tela = {
init: function(){
this.varUm = null;
var thisLocal = this;
$("#btn").click(function(){
alert(thisLocal.varUm);
});
$("#btnSetar").click(function(){
thisLocal.SetarValor();
});
},
SetarValor:function(){
var thisLocal = this
$.get('/echo/json/',{},function(data){
thisLocal.varUm = data
});
}
}
$(document).ready(function(){
nome_da_tela.init();
});