javascript can come from anywhere: script tag's .src is not domain-specific.
the games don't use ajax at all: no xml, no xmlHttpRequest...
they simply load a script tag (which again can come from anywhere), and the code inside the external script tells the game client how to draw the board.
this pattern is called JSNOP, however the game doen't use JSON, but actual raw JavaScript instructions to achieve the same basic thing.
php kinda sucks for doing this, nginx or node.js would be far more efficient since the only way to update external values in-page in php is through a flat file or db, whereas the other guys can share values while the page is in session.
ok, that's not a coherent explanation, let me try again:
if a php page takes 10 seconds to build due to using sleep(), the only way to have data available at second #9 that wasn't available at second #1 is to load a file or query a DB.
basically, you have to commit the move to a db with one client, then poll the db with the running long-poll page until a change is found.
with node.js, users of a single game can share a regular JavaScript object in ram, eliminating the need for DBs/files. Additionally, node.js can raise an event on all other game player's connections the instant a change to the game data occurs, which eliminates the need for polling.
the performance diff of using node.js is akin to moving from document.write() to div.innerHTML: you don't need a "refresh" from an external data source to make new info available, and many pieces can be updated independently of other pieces.
to wit: in node.js i can load a 20mb json into ram at boot, and every request has access to that big variable using closure from the request event's function to the global variable. php would have to load/parse the same big file every time someone asked for it...