0

It's my first steps in learning javascript, and I have simple code:

$(function(){
  for(var i = 0; i < 5; i++) {
    $.get('/', function(data) {
      console.log('Request ' + i + ' succeeded');
    }); }
});

but for me it shows only last string: "Request 5 succeeded", why does it show only last one? How can I fix it?

Rohan Kumar
  • 40,431
  • 11
  • 76
  • 106
elektrobober
  • 83
  • 10

0 Answers0