Access Json outside of javascript each function

Saturday, July 5, 2014

below is my script,



var holidays = {};
var count=0;
$('.row').each(function(index) {
var names = document.getElementById('name['+count+']').value;
var dates = document.getElementById('dateh['+count+']').value;
holidays[names] = dates;
count ++;
console.log(holidays);
});


If i do console.log(holidays); inside the function i can get the json object, but if i do the same outside of $('.row').each(function(index) it's not printing any.


Did anyone know where i'm going wrong ?







http://ift.tt/1vJhH3Q