November 15th, 2006, 08:19 AM
Need help in update values without refreshing
Hi guys. I'm having a prob here and would like some help . The basic idea is I am making a web based game, an interactive one. The game is able to create different rooms for 1 vs 1 battle.
For every room created, a php file named as the room name is created which keeps a temp record of the players status example ($HP = 200 and things like that. This php file updates in real time during gameplay. I include this php into the players page so it can display the status, but however I can't auto update it real time without refresh.
So is there anyway I can re-include the php file every x seconds so that the old values can are updated with new ones? Or anyway I can keep retrieving the new update values from the php file to work with? Thanks in advance .
November 15th, 2006, 06:52 PM
November 16th, 2006, 02:33 AM
I've read up on AJAX and some AJAX examples on the net. But most examples on the net only show results in text without refresh. So if AJAX is the best solution to it, can anyone show me the way to update the values using AJAX every x seconds ? Sorry but I really know nuts with AJAX or you can also say i am very noob in writing scripts, lolz .
November 17th, 2006, 02:42 AM
Hey, I've found the solution to it. Thanks for the help anyway but i've another problem rising after this one that I've overlooked, damn. lolz ! I call the following functions every x seconds using a js setTimout().
but after a few tries of retrieving the file from server, the browser don't bother to fetch and it keeps retrieving the old file inside my temp internet folder which has the old data.
Can anybody care to help me with this?
November 17th, 2006, 12:15 PM
Try calling include_dom() with something like this, it should trick the browser into reloading a full version of your js every time.
var src = 'http://whatever.com/whatver.js?'+ Math.random() +'';
November 18th, 2006, 12:44 PM