Hi -

I want to use javascript to validate some fields on a form.
The javascript code will take the value the user typed
into the form and search for it in an array.  If the value
is found in the array, then the value is ok, otherwise
an alert() message will be displayed.

The amount of data in the array is quite large.

The data in the array rarely changes.

I want to avoid transferring the array from the web server
to the client's web browser every time the user loads the
form.  I put the array in a file called "myarray.js":

$ cat myarray.js
var MyArray = new Array(
        "value 1",
        "value 2",
<many lines snipped>
        "value 789",
        "value 790"
);
$

Then, I put the following line in the php script that generates the form:

<script language="JavaScript" src="myarray.js"></script>

By examining Apache's access_log, I see that "myarray.js" is
transferred to the user's web browser once when the form is first
displayed, and for subsequent uses of the form, the web browser
uses the myarray.js that is cached, so that the array does not
have to be transferred from the web server to the client computer
every time the user uses the form.

So, if the data in the array contained in myarray.js _does_ need
to be changed, I need some way of signaling the user's web browser
that it needs to transfer the updated myarray.js file from the web
server.  How do I do this?

The only way I know to do this is to instruct the users to clear their
web browser cache, which will force the web browser to transfer
the updated myarray.js from the web server to the web browser.

Is there another way?  Is there some kind of "expire" mechanism
that will tell the web browser that it needs to get the updated
myarray.js file?

Thanks -
Jim Ide




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to