Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

The Grid - A Web game for Programmers and Strategists, but need Ajax help

 
Gary Fisher
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://celtruler.com/games/thegrid/

It's a browser game that is going well but the Ajax requests sometimes don't complete, or rather they complete, but the text to be updated doesn't always update, mainly in Chrome. Any ideas? The game is in PHP now, but could be implemented in Java at some point. Thank you kindly in advance.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64970
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you used the developer tools and the JavaScript console to find out what's different about the requests that don't work as expected?
 
Gary Fisher
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes I have used the JS console, but there are no errors being thrown. In fact, what happens is that everything basically works, but every so often if I leave the web page for a while and then come back and press a button that triggers an AJAX request, nothing happens visually... The process goes through on the back-end, but on the front-end there is no manifestation until the page is refreshed. This only happens once in a while, and I'm wondering if that's a normal thing with AJAX, or is there truly some bad code that's to blame. Thank you.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64970
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope, not "a normal thing".

In the cases where it's not working, have you checked the response to see if it contains what it should? Just looking for console errors is not enough.
 
Gary Fisher
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. I believe it may be because it's so Javascript intensive, that because there are several AJAX requests firing every second, and also some additional parsing going on (some of which could be done away with) after a minute or so the Javascript may get stuck and not execute. I believe I can probably fix it by cutting out the extra parsing, cutting down on the number of requests, and also by possibly putting more time between the requests.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic