;

PDA

Click to See Complete Forum and Search --> : Freeing variables


tmburge
05-02-2005, 06:17 PM
How do I force KoolMoves to free and reassign a variable? For example. I have a guestbook. A user posts a new entry (which is sent to MySQL as a record). When the user goes back to the guest book, I want them to see their entry. I have verified that the entry goes into MySQL, and here is what I do to try to get a new guestbook list:

guestbooktext = ""; // trying to clear this dynamic text variable
this.loadVariables("getentries.php","POST"); // creates the guestbooktext.txt file (this works)
loadVariables("guestbooktext.txt", "_root"); // attempt to reload the guestbooktext variable.

However, it does not work instantly...it takes a few minutes for the new file to be created...

w.brants
05-03-2005, 01:48 AM
Most likely freeing the variable won't help you. I guess the problem in this case is that your browser caches the txt file.

A solution could be to request a different url each time.
now = new Date();
filename = 'guestbooktext.txt?' + now.getTime();
loadVariables(filename, "_root");
Another way could be to use sendAndLoad() to post and retrieve at the same time and only use php files. If you make sure your php file sends the proper no cache headers that should also work.

tmburge
05-03-2005, 09:27 AM
The code you provided worked like a charm...it was a caching problem.

Tony