There is a form in which the fields are loaded via Ajax . Each field is assigned an id , for example, birthdayosoba_0 , birthdayosoba_1 , etc. There is also a field with the number of fields I need to add. In the script itself, I pull out the number of fields and assign a value to a variable. Then, in a cycle, I assign dynamic values to dynamic variables. And then I need to throw the values obtained on the handler via Ajax .
Js code:
function osoby_calc2() { var kil_osoby = document.getElementById('kil_osoby').value; for (var i = 0; i < kil_osoby; i++) { window['point_' + i] = document.getElementById("birthdayosoba_" + i).value; alert(point_0); //чисто для проверки работоспособности } $("#osoby_calc3").load("osoby_calc.php", { kil_osoby : kil_osoby }); } When cleaning:
for (var i = 0; i < kil_osoby; i++) { window['point_' + i] = document.getElementById("birthdayosoba_" + i).value; alert(point_0); //чисто для проверки работоспособности } then the data is normally transferred to the handler. But if part of the code is present, then alert() works, but the data does not go away.
Where am I wrong? PS: I will ask you not to give advice on arrays, etc. There is no possibility to use them, you need to correct this example. Thank you in advance.
ihavedocument.getElementById("birthdayosoba_" + i).value? - Rolandius