Date:  07/16/2008 03:03:31 PM Msg ID:  003768
From:  FoxWeb Support Thread:  003765
Subject:  Re: JavaScript Array to foxpro
You can still pass it through Ajax, or a hidden form field.  Regardless, you will need to serialize the array to a string and then write code on the server to convert the string back to its array format.  The easiest way to serialize JavaScript objects (including arrays) is to use the toString() method, which essentially converts them to a JSON string.   Arrays will look like this:
For details on JSON visit  Writing a generic JSON parser in VFP is a bunch of work, but writing a parser that only reads one-dimensional arrays is really easy.
Alternatively, you can upgrade to version 4.  Wink
FoxWeb Support Team email
Sent by Don Bailey on 07/16/2008 12:04:47 PM:
Thank you for the quick reply! But...
I don have the latest version of FoxWeb. I have used hidden form fields to transfer from javascript to VFP in the past, but what i'm dealing with now is an JavaScript ARRAY.  How can I pass an ARRAY via a hidden field?
Sent by FoxWeb Support on 07/16/2008 11:56:21 AM:
I assume you are referring to JavaScript code that is running within the browser. In order to store the data in the array to a table, you will first need to transfer it to the server.  You can either use traditional techniques, where you use JavaScript to copy the data to a hidden form field and send trigger the form's submit method, or utilize Ajax, which is more elegant and, in this case, just as easy.
If you choose to use Ajax and you have FoxWeb 4, the best approach would be to send the array in the form of a JSON string to a server page that will utilize FoxWeb's fwJSON object to convert it to a VFP array.  Please refer to the ZipSearch sample code for details.
FoxWeb Support Team email
Sent by Don Bailey on 07/16/2008 10:43:54 AM:
I have a JavaScript array that I have built and I want to use it to update a table in VFP.  Can anybody tell me how to get at the javascript array data from vfp?