•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 375,217 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,260 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 18429 | Replies: 1
![]() |
•
•
Join Date: Dec 2004
Location: Washington DC
Posts: 10
Reputation:
Rep Power: 4
Solved Threads: 1
•
•
•
•
Originally Posted by Deepa
how to pass a array from asp to javascript
You might want to use the join method in Jscript to populate your client side javascript. Use the join like this on an array called cars:
<%
var sep = "','";
var carlist = cars.join(sep);
%>Note: Make sure that you include the appropriate quotes in the sep string. Its very difficult to illustrate here but you need a doublequote then singlequote then a comma then a single quote and then a double quote (with no spaces in between): "','"
Then take the list that was created and populate your clientside script. I will create the clientside javascript array called fooCars:
<script language="JavaScript">
fooCars = new Array('<%=carlist%>');
</script>Again make sure that you surround your variable call in ASP by single quotes.
This should do it.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
- paging recordsets with ASP Javascript NOT VB (ASP)
- Pass parameters between Javascript and ASP (JavaScript / DHTML / AJAX)
- How do I pass data from a recordset on asp page towards an array on js file (HTML and CSS)
- How do I pass data from a recordset on asp page towards an array on js file (JSP)
- transfer double array from asp to javascript (ASP.NET)
- C++ pass 2d array into function (C++)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: No page header and footer when printing a web page
- Next Thread: How to have two clocks on one php forum?


Linear Mode