Array values?

Hello, I am trying to figure out why I cannot display this array's values?

Error:
Uncaught TypeError: Cannot read property "1" of undefined.

*vbscript array*
<% rs2Array = rs2.GetRows %>

*javascript array*
var rs2Array = Array(<%=rs2Array %>);
    alert(rs2Array[0][1]);

Open in new window

AhelblingAsked:
Who is Participating?
 
Julian HansenCommented:
I don't think the author is mixing the two - using a vbscript to create a javascript but I think CD& has nailed it should be

var rs2Array = new Array(<%=rs2Array %>);
    alert(rs2Array[0][1]);

However, it also depends on what the rs2Array output looks like and from the post it looks like it is a recordset which means that you will probably need to iterate through the recordset and build the array initialisation string in a jscript compatible manner.

I am assuming this outputs something - what is the resulting output (not of the alert) of the actual underlying script?
0
 
COBOLdinosaurCommented:
vbscript and javascript are not interchangable.  In any case to declare the javascript you probably need to declare the object as new Array, not just Array.


Cd&
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.