The "it" that you were asking about was the server. The javascript file is
actually a PHP file that produces the JavaScript that I need. I only have
one access to a database and a while loop to generate the code. Here is the
code pieces:
[code]
// already connected to the db
$sql = "SELECT * FROM Customers ORDER BY LastName ASC, FirstName ASC";
$result = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_assoc($result)) {
// generate the javascript
}
[/code]
The customer database can get potentially large so that this file could take
a while to generate. Currently there are only 300 records but I anticipate
many more. Does anyone have any recommendations that might speed this up?
Josh
"- Edwin -" <[EMAIL PROTECTED]> wrote:
> > Does anybody know how I can make force a javascript file (written in
> > PHP) to be cached if the user agent allows it?
> >
> > Here is the situation:
> > I am creating a dropdown menu system that contains a customer list,
> > loaded from a database. This list is written to the javascript file
> > for the menu. The menu can be quite large as the data grows. What I
> > would like to do, is force it to be cached (unless of course the
> > user agent doesn't allow it) so that it doesn't have to make the
> > call to generate the file each time.
>
> What is the second "it" in the last sentence above? A browser wouldn't
> make the call to "generate" the javascript file each time.
>
> > I have searched through the php.net website and even through the
> > HTTP/1.1 protocols. I am continuing to look, but have not found a
> > definite answer as to whether or not what I am trying to do is
> > possible.
>
> Just make sure that the javascript is on a separate file (i.e.
> whatever.js) and that it's NOT being generated by your (php) script
> each time. Then, "call" that file from inside your html/php page.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php