DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: arrays from server side to client side

  1. #1
    srivatsa Guest

    arrays from server side to client side


    I have a two dimensional array at the server side (vbscript)
    which is populated by using recordset.getrows() method

    now I need to transfer this array to client side (javascript)
    so that I can work on it at and display it in various
    ways at the client side using javascript

    how do i do this?


  2. #2
    Sidewinder Guest

    Re: arrays from server side to client side

    Dynamically create the JavaScript and populate the JS arrays in ASP code.

    'create and populate ASP array then
    response.write "<SCRIPT LANGUAGE=""JavaScript"">"

    //this declares a 2 dimensional (5 by 3) JS array. JS can only handle arrays
    of arrays, no native support for multidimensional arrays.

    Response.Write "var JSArray = new Array(5);" & chr(13)
    Response.Write "for(x=0;x<5;x++){JSArray[x]= new Array(3);" & chr(13)

    //Now you have to populate it
    For x = 0 to 4
    For y = 0 to 3
    response.write "JSArray[" & x & "][" & y & "] = "" " & ASPArray(x,y)
    & " ""; " & chr(13)

    response.write "</SCRIPT>"

    You now have a dynamically generated two-dimensional JavaScript array that
    you can manipulate on the client.

    Good luck!

  3. #3
    srivatsa Guest

    Re: arrays from server side to client side

    thanks a lot
    sometimes there are simple solutions to complex problems,
    which we tend to overlook very easily


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center