1

Hi i have following code

$(args.data0).find('group').each( function() ...

Variable args is create by AJAX call and it contains data0, data1, ... dataN How can i programatically iterate over all these variables? Something like that packed in some kind of forEach cycle :)

$(args.data0).find('group').each( function() ...
$(args.data1).find('group').each( function() ...
$(args.dataN).find('group').each( function() ...

Many thanks

user1453857
  • 207
  • 1
  • 3
  • 13
  • You could iterate object args. There is posted [answer](http://stackoverflow.com/questions/1096924/iterating-a-javascript-objects-properties-using-jquery) – Stanislav Terletskyi Jun 14 '13 at 12:37
  • you mean with pure javascript?? because thats that each function does – Ligth Jun 14 '13 at 12:37
  • Fix the source data so that it contains an array instead of an object with properties with a pattern based name. – Quentin Jun 14 '13 at 12:37

1 Answers1

3
for(var i = 0; i <= n; i++){
    $(args['data' + i]).find('group').each( function() ...
}
karaxuna
  • 26,752
  • 13
  • 82
  • 117