Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 12th, 2005, 10:47 AM
Registered User
 
Join Date: May 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Transfer double array from asp to javascript

...need help...
I've created a double array and populate it with data from a database. I can read the values it holds in ASP but I cannot do it in Javascript. Is there any way this can be done?
Thanks

 
Old May 17th, 2005, 06:40 AM
Authorized User
 
Join Date: Jul 2004
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to raj_makro
Default

Check out this example which reads a double array "abc" of ASP to double array "a" of javascript
<%
   dim abc(2,2)
   abc(0,0)="a"
   abc(0,1)="b"
   abc(0,2)="c"
   abc(1,0)="d"
   abc(1,1)="e"
   abc(1,2)="f"
   abc(2,0)="g"
   abc(2,1)="h"
   abc(2,2)="i"
%>
<script language="javascript">
a=new Array(<%=ubound(abc,1)+1%>)
for (i=0;i<<%=ubound(abc,1)+1%>;i++)
    a[i]=new Array(<%=ubound(abc,2)+1%>)
<%
   for i=0 to ubound(abc,1)
    for j=0 to ubound(abc,2)
          Response.write ("a[" & i & "][" & j & "]='" & abc(i,j) & "';" & vbcrlf)
    next
   next
%>
for (i=0;i<<%=ubound(abc,1)+1%>;i++)
   for (j=0;j<<%=ubound(abc,2)+1%>;j++)
    alert(a[i][j])

</script>


Regards
Raj





Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP/MySql database into JavaScript Array Hazzardusa Classic ASP Databases 1 August 14th, 2005 10:02 PM
Transfer data from 1 array to another dna2 Excel VBA 5 March 14th, 2005 06:20 AM
Reference ASP Array in Javascript gaetano Classic ASP Basics 1 February 21st, 2005 10:09 AM
Passing php array values to javascript array gkrishna Pro PHP 0 November 6th, 2004 03:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.