View Complete Thread | FoxWeb Forum Home
Search:
Date:    Msg ID:   
From:    Thread:   
Subject:   

The first thing I would like to ask you is if the data needs to be in a session variable to begin with.  In general, session variables should hold data that is not specific to any one page, but rather applies to the whole application.  In other words, if the user were to use the back button, session data should still be applicable. 

Examples of information that is suitable for session variables:

  • Login information
  • Site wide preferences
  • Items that the user added to a shopping cart

Examples of information that is not suitable for session variables:

  • User selections in a wizard interface, or the page in the wizard that the use is currently on
  • The page that the user is viewing in interfaces where search results are displayed in smaller groups (think Google results).

Assuming that your particular situation calls for the use of session variables, now you have to find a way to send the data in question to the server.  JavaScript code runs on the browser, so it can't interact directly with the FoxWeb API.  The only way to set up a session variable from JavaScript code is by making a connection back to the server.

Does the data need to go to the server immediately, or can it wait until the user makes another request to the server?  If it can wait, then one possibility, would be to be to store this data in a JavaScript variable that gets submitted to the server via the query string, or hidden form field when the user clicks on a control (hyperlink, or form submit button) that causes a server connection.

Another possibility is to use Ajax, which allows HTTP requests to be made asynchronously in the background.  For information and examples on the use of Ajax, search this forum, or the web.  Ajax is primarily a client side technology, so it's not FoxWeb-specific.  Also, FoxWeb 4 comes with an Ajax example (ZipSearch).

FoxWeb Support Team
support@foxweb.com email
Sent by George Gambill on 12/10/2007 05:20:22 AM:
Is there a way to set a session variable with JavaScript such that FoxWeb can retrieve that variable with the session.getvar command?