| | |
how to pass a array from asp to javascript
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
•
•
Originally Posted by Deepa
how to pass a array from asp to javascript
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<% 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:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<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.
![]() |
Similar Threads
- pass variable from php to javascript (PHP)
- Pass a 2D-array with AJAX (JavaScript / DHTML / AJAX)
- paging recordsets with ASP Javascript NOT VB (ASP)
- 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?
| Thread Tools | Search this Thread |
acid2 ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate array automatically beta box browser bug calendar captchaformproblem cart close codes column css cursor date debugger decimal dependent design disablefirebug dom download dropdown element embed engine enter error events ext file firefox focus form frameworks getselection google gwt gxt hiddenvalue highlightedword hint html htmlform ie7 iframe index java javascript javascripthelp2020 jawascriptruntimeerror jquery jsp libcurl listbox maps masterpage media menu microsoft mimic mp4 onmouseoutdivproblem onmouseover paypal pdf php player position post problem programming progressbar prototype redirect regex safari scale scriptlets scroll search security select software sql text textarea unicode w3c website window windowofwords windowsxp





