I am using classic .asp. I have the following:
<script language="javascript">
var JSintTotal = <% =intTotal%>;
var JSarrHotelsProdCols = Create2DArray(JSintTotal);
<%
for x = 0 to intTotal - 1
response.write "JSarrHotelsProdCols["&x&"][0] = "&arrHotelsProdCols(0,x)&"';" & vbCrLf
response.write "JSarrHotelsProdCols["&x&"][1] = '"&arrHotelsProdCols(1,x)&"';" & vbCrLf
response.write "JSarrHotelsProdCols["&x&"][2] = '"&arrHotelsProdCols(2,x)&"';" & vbCrLf
response.write "JSarrHotelsProdCols["&x&"][3] = '"&arrHotelsProdCols(3,x)&"';" & vbCrLf
next
%>
</script>
The Create2DArray() function is working properly, I grabbed from this site.
If I comment out the for/next loop and make x=0, this will populate JSarrHotelsProdCols[0][0] through JSarrHotelsProdCols[0][3] with the correct values in arrHotelsProdCols(0,0) through arrHotelsProdCols(3,0). I check this using an alert function onDblClick after opening the .asp page.
I can also see the text written to the ‘page source’:
JSarrHotelsProdCols[0][0] = '4 MEX HOTEL & LIVING';
JSarrHotelsProdCols[0][1] = '3 STAR';
JSarrHotelsProdCols[0][2] = '2KM';
JSarrHotelsProdCols[0][3] = '8KM';
However, when I run the for/next loop I cannot see the values in the JSarrHotelsProdCols array using the same alert function, but I can see all 612 x 4 statements written out correctly in the ‘page source’.
Why is this not working when I loop through this assignment but it works when I don’t loop through it?
Let me know if you need more info, I wasn't sure how much is enough.
Thanks.