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
asked Jun 14, 2013 at 12:32
user1453857
2071 gold badge3 silver badges13 bronze badges
-
You could iterate object args. There is posted answerStanislav Terletskyi– Stanislav Terletskyi2013年06月14日 12:37:21 +00:00Commented Jun 14, 2013 at 12:37
-
you mean with pure javascript?? because thats that each function doesLigth– Ligth2013年06月14日 12:37:42 +00:00Commented Jun 14, 2013 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– Quentin2013年06月14日 12:37:46 +00:00Commented Jun 14, 2013 at 12:37
1 Answer 1
for(var i = 0; i <= n; i++){
$(args['data' + i]).find('group').each( function() ...
}
answered Jun 14, 2013 at 12:38
karaxuna
26.9k13 gold badges86 silver badges120 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-js