?
Solved

Array values?

Posted on 2012-08-17
2
Medium Priority
?
239 Views
Last Modified: 2012-08-21
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

0
Comment
Question by:Ahelbling
2 Comments
 
LVL 53

Assisted Solution

by:COBOLdinosaur
COBOLdinosaur earned 1000 total points
ID: 38305403
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
 
LVL 60

Accepted Solution

by:
Julian Hansen earned 1000 total points
ID: 38305487
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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question