0

My Code is as such:

for (var i=0; i < numaccounts; i++) { 
    $.post('assets/ajax/multi-save.php', appointments[i], function(data) {
      alert(appointments[i]);
      alert(appointments[0]);
    });
}

the problem seems to be with my array appointments. The second with the fixed offset of 0 displays fine. The one using 'i' displays as 'undefined'. If I alert(i) it is always '2'.

NotaGuruAtAll
  • 503
  • 7
  • 19

1 Answers1

0

Ah, all it took was a little more searching:

jQuery ajax inside a loop problem

Explains the problem and gives the solution.

Community
  • 1
  • 1
NotaGuruAtAll
  • 503
  • 7
  • 19