Hello everyone,
This question is often asked, and I know there are lots and lots of answers that I could be using, but I just want a clear good answer.
I am making a website (for playing a game called Go).
It has a page for each game of course.
I'm making the website in PHP and MySQL, I know that for 'real-time' games another solution would probably be better, but I'm learning to master php and MySQL.
The game is shown via the <canvas> tag (using php and mysql to write the javascript, with in its turn writes the <canvas>).
Now it can happen that the game develops in one browser, but the old game board is still shown in the other.
I want to solve this issue using AJAX page refreshing.
I think it's possible to refresh the game every like 10/20/30 seconds, without the page reloading, so the page also doesn't go back to the top every refresh, but stays at it's scroll position.
The clearest answer to my problem i found here:
http://aleembawany.com/2005/09/01/ajax-instant-tutorial/
...now all I really have to do is add an automatic timer, so the div containing the game board automatically refreshes.
...Could someone help me, pretty much step by step? ( I may know a bit about html/php/mysql/css/design and stuff, but I REALLY REALLY suck with javascript. My javascript is usually just copy/paste work... )
Cheers!
Kelley van Evert
This question is often asked, and I know there are lots and lots of answers that I could be using, but I just want a clear good answer.
I am making a website (for playing a game called Go).
It has a page for each game of course.
I'm making the website in PHP and MySQL, I know that for 'real-time' games another solution would probably be better, but I'm learning to master php and MySQL.
The game is shown via the <canvas> tag (using php and mysql to write the javascript, with in its turn writes the <canvas>).
Now it can happen that the game develops in one browser, but the old game board is still shown in the other.
I want to solve this issue using AJAX page refreshing.
I think it's possible to refresh the game every like 10/20/30 seconds, without the page reloading, so the page also doesn't go back to the top every refresh, but stays at it's scroll position.
The clearest answer to my problem i found here:
http://aleembawany.com/2005/09/01/ajax-instant-tutorial/
...now all I really have to do is add an automatic timer, so the div containing the game board automatically refreshes.
...Could someone help me, pretty much step by step? ( I may know a bit about html/php/mysql/css/design and stuff, but I REALLY REALLY suck with javascript. My javascript is usually just copy/paste work... )
Cheers!
Kelley van Evert
Comment