Array values?

Posted on 2012-08-17
Last Modified: 2012-08-21
Hello, I am trying to figure out why I cannot display this array's values?

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

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

*javascript array*
var rs2Array = Array(<%=rs2Array %>);

Open in new window

Question by:Ahelbling
    LVL 53

    Assisted Solution

    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.

    LVL 50

    Accepted Solution

    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 %>);

    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?

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Both jQuery and Mootools offer some nice, easy to use scripts. Mootools is best known for their interactive slideshows and jQuery for their menus, but both have many other uses as well.   jQuery is basically a toolkit with many DOM (http://en.wik…
    Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
    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…

    734 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

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now