|
-
Freeing variables
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...
-
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.
code: 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.
-
Thank you, w.brants
The code you provided worked like a charm...it was a caching problem.
Tony
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|