Using node.js, I am trying to access a variable I declared at the beginning of a function from within an else statement in a do while loop:

```
function myFunction(){
    var limit = 2000;
    var count;
    var total;
    var runningTotal = 0;
    var url = 'http://example.com';
    var self = this;

    do{
        request({'url': url}, function (error, response, body) {
            if(error)logger.error(error);
            else{
                count = JSON.parse(body).count;
                console.log('count = ' + count);
                total = JSON.parse(body).total;
                console.log('total = ' + total);
                runningTotal+=count;
                console.log('running total = ' + runningTotal);
                var parsedBody = JSON.parse(body);
                self.parseResults(parsedBody.rows);
            }
        });
    } while(total > runningTotal);
}

```

When I run this code, the count, total and running total are logged out correctly, but the function level count, total and running total variables are undefined, so the while only runs once. Why is this, and how can I update these variables from within the else?