Can I pass arrays from server to client side?

Results 1 to 3 of 3

Thread: Can I pass arrays from server to client side?

  1. #1
    Join Date
    Dec 1969

    Default Can I pass arrays from server to client side?

    Hi Everyone,<BR> I would like to pass an array from Server side to Client side.<BR>I would like to store this array at clients area in JavaScript so that everytime the client request, it can take from the array without processing the same thing from the server..<BR> I have a txt file in this formate:<BR><BR> 1. Description of the Frist line...<BR> 2. Description of second line<BR> 3. Description of third line<BR> 4. Description of forth line..and so on..<BR><BR> Now, when I access this txt file, I want to put in array<BR>like Ar(0) = line One, Ar(1) = line two, Ar(2) = line three so on. and send it to client&#039;s side. Is it possible?<BR>If I can do in this way, accessing will be much faster. Can anyone give me some suggestion? Even the related information or links would be fine? Please Help!<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Can I pass arrays from server to client side?

    Try to use split(),<BR>e.g.<BR>let&#039;s say rs("text") has the following value:<BR>John is a student<BR>Mary is a student too<BR>Paul is a schoolboy<BR>...<BR>txt=split(rs("text"),vbNewLine )<BR>Response.Write (txt(0))<BR>Response.Write (txt(1))<BR>Response.Write (txt(2))

  3. #3
    Join Date
    Dec 1969

    Default Try this....

    if you were using vbscript at the client end this is how to do sure the javascript isnt so disimilar.<BR><BR>&#060;%<BR>Option Explicit<BR><BR>Dim sServerArray(2)<BR>Dim i<BR><BR>On Error Resume Next<BR>sServerArray(0) = "line1"<BR>sServerArray(1) = "line2"<BR>sServerArray(2) = "line3"<BR><BR>&#039;write html header, etc first <BR>Response.Write("&#060;HTML&#062;&#060;HEAD&#06 2;&#060;SCRIPT language=" & Chr(13) & "vbscript" & Chr(34) & "&#062;" & Chr(13))<BR>Response.Write("Option Explicit" & Chr(13))<BR>Response.Write("Dim sClientArray(2)" & Chr(13))<BR>Response.Write("Sub Window_OnLoad" & Chr(13))<BR>For i = LBound(sServerArray) To UBound(sServerArray)<BR> Response.Write("sClientArray(" & CStr(i) & ") = " & Chr(34) & sServerArray(i) & Chr(34) & Chr(13))<BR>Next<BR>Response.Write("End Sub" & Chr(13))<BR>Response.Write("&#060;/SCRIPT&#062;&#060;/HEAD&#062;&#060;BODY&#062;")<BR><BR>&#039;write rest of html<BR>Response.Write(..........<BR>%&#062;<BR><B R>hope this helps. jb

Posting Permissions

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