Below, you can see the output from these two logs. The first clearly shows the full object with the property I\'m trying to access, but on the very next line of code, I can\
I've had similar issue, hope the following solution helps someone.
You can use setTimeout
function as some guys here suggesting, but you never know how exactly long does your browser need to get your object defined.
Out of that I'd suggest using setInterval
function instead. It will wait until your object config.col_id_3
gets defined and then fire your next code part that requires your specific object properties.
window.addEventListener('load', function(){
var fileInterval = setInterval(function() {
if (typeof config.col_id_3 !== 'undefined') {
// do your stuff here
clearInterval(fileInterval); // clear interval
}
}, 100); // check every 100ms
});