Passing JScript array back to server.

Results 1 to 2 of 2

Thread: Passing JScript array back to server.

  1. #1
    Join Date
    Dec 1969

    Default Passing JScript array back to server.

    Could someone help me decide how best to pass a Javascript multidimensional array back to the server from the client? (i.e. should I create several hundred hidden inputs with the appropriate values or is there another way) The array is as follows: jsarray[r][c]; where r is a number from 0 to n and c is 0 to 3. Thanks!

  2. #2
    Join Date
    Dec 1969

    Default As a hidden form field

    for ( row = 0; row &#060; jsarray.length; ++row )<BR> jsarray[row] = jsarray[row].join("$$");<BR> lue = jsarray.join("##");<BR><BR>*************<BR><BR>In your ASP code, you can then reconstitute the array of arrays:<BR><BR>&#060;%<BR>vbarray = Split( Request.Form("TheHiddenField"), "##" )<BR>For i = 0 To UBound(vbarray)<BR> vbarray(i) = Split( vbarray(i), "$$" )<BR>Next<BR>%&#062;<BR><BR>Now you will have to access the elements of that VB array in the same fashion you access JS arrays:<BR> cell = vbarray( row )( column )<BR><BR>[You could go to the trouble to convert it to a true 2D array, but why? The above is tons faster and accessing array elements in that way is nearly identical in performance.]<BR><BR><BR><BR>

Posting Permissions

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