Home
TeamSite
Accessing PERL array in Javascript
sspopuri
I have a array in my CGI script. And I want to access it in Javascript. How do I do it?
I tried using "
@array"
but it doesn't work. Am I doing something wrong?
Find more posts tagged with
Comments
akshathp
You will need to provide more details about how you are writing the JavaScript code in your CGI. Based on that there can be different ways to access CGI variables in JavaScript.
Could you post your code as an attachment?
Here is a quick example though:
print "myArr = new Array('". join '\',\'',
@data
. "')"
In this example, you will notice data array has the values which I am using in JavaScript array declaration.
Hope this helps!
Akshat Pramod Sharma