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

3
  • You could iterate object args. There is posted answer Commented Jun 14, 2013 at 12:37
  • you mean with pure javascript?? because thats that each function does Commented 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. Commented Jun 14, 2013 at 12:37

1 Answer 1

3
for(var i = 0; i <= n; i++){
    $(args['data' + i]).find('group').each( function() ...
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.