I have this code where tabsActive
var turns into Javascript object as image below shows:
var tabsActive;
$(document).ready(function () {
$.get(Routing.generate('configuracionPestanas', {
estado_solicitud: 1,
tipo_tramite: 1
}), {}, 'json').done(function (data, textStatus, jqXHR) {
tabsActive = JSON.parse(data.estadosWz[0]);
console.log(tabsActive);
});
var tipoTramiteSolObj = $("select#solicitudUsuario_tipoRegistro"),
oficinaRegionalSolObj = $("input#solicitudUsuario_oficinaRegional"),
tipoTramiteSolVal;
oficinaRegionalSolObj.select2({
....
}).select2("enable", tabsActive.wzSolicitud[0]);
});
Now I need to access a that object outside $.get
request but seems like it doesn't exists since I get error on the line where I'm trying to access object properties:
select2("enable", tabsActive.wzSolicitud[0])
Why? What is the right way to access the object outside the $.get
request?