I have declared global variable named counter=0 on my index.html page inside head section
<script>
var counter=0;
</script>
now in my one of function i am setting its value as
function getCounter(param)
{
$.getJSON("somewebserviceURL&format=json&callback=?",
function(data)
{
$.each(data, function(i, item)
{
counter++;
});
});
//I am not able to get the latest value here & in upcoming functions which use this variable
alert(counter);
}