declare variables in loop and pass the values throgh GET request?
here's a part of my JS code which supposed to get some elements by id and my first problem is how to declare the variables inside the loop (num_of_users is a variable)
My second question is HOW to pass these variables through :
num_of_users = encodeURI(document.getElementById('num_of_users').value);
for (var i=2;i<=num_of_users;i++)
username_2 = encodeURI(document.getElementById('username_2').checked);
username_3 = encodeURI(document.getElementById('username_3').checked);
username_4 = encodeURI(document.getElementById('username_4').checked);
//. and so on until num_of_users
Is it possible to pass an array? Did someone have a similar issue? Any suggestion will be highly appreciated!
P.S. How to format the code to be JS - like [ php ] for php?