How do I retrieve data from database and put the data in a JavaScript array variable?

Ravi Verelly

(Assuming your server supports server-sde JavaScript...) Write server side script to get data from data base. Some thing like this will work:
<script> var a = new Array(); </script> <% int i=0;
ResultSet rs = stmt.executeQuery(sqlQuery);
while ( {
i++; %>
<script> a[<%=i%>] = "<%=rs.getString(0)%>"; </script>

About | Sitemap | Contact