Results 1 to 2 of 2

Thread: Arrays

  1. #1
    Sarita Guest

    Default Arrays

    I have a database , i am retrieveing records from the table into an array(using vbScript)<BR>now i wanna use this array in a client side script(javascript) when i use this array in a javascript functon..i encounter an error as to "Array undefined". how can i use the values in the array in my javascript function.

  2. #2
    Join Date
    Dec 1969

    Default RE: Arrays

    IMPORTANT CONCEPT: client and server are completely seperate. You can send HTML etc to the client, but the client has no access to variables held in the memory of the server. In fact, by the time the client sees that page it has stopped executing on the server and those variables have been garbage collected (not that you could get at them anyway).<BR><BR>To get an array from the server to the client, the easiest option is to Response.Write javascript to create the array on the client:<BR><BR>Response.Write("&#060;script laguage=&#039JavaScript&#039&#062;" & vbCRLF)<BR>Response.Write("var JSArray(" & Ubound(VBArray) & ");" & vbCRLF)<BR>For i = 0 To Ubound(VBArray)<BR>**Response.Write("JSArray[" & i & "] = " & VBArray(i) & ";" & vbCRLF)<BR>Next<BR>Response.Write("&#060;/script&#062;")<BR><BR>Dunc

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts