Board18New2

From BOARD18 Project WIKI
Jump to navigation Jump to search
This page has been updated to comply with Release 2.6.x of BOARD18. Go Back

board18New2.js contains all of the code to actually create a new game and inform the players of this fact.

Function isNumber(n)

I found this generalized numeric test function at http://stackoverflow.com/questions/18082/

  validate-numbers-in-javascript-isnumeric 

Function goToMain()

The goToMain function transfers control to the board18Main.php page.

Function delayGoToMain()

The delayGoToMain function waits 3 seconds before calling the goToMain function.

Function killGoToMain()

The killGoToMain function stops any delayed calling of the goToMain function.

Function makeNewGame(name, boxid, players, player)

Function makeNewGame creates a JSON object for the ajax newgame call.

Function emailPlayerResult(response)

Function emailPlayerResult is the call back function for the ajax calls to emailPlayerAdd.php. It only needs to check for errors and it only needs to report the first error. Before reporting this error it will call the killGoToMain() function.

Output from emailPlayerAdd.php is an echo return status:

 "success" - Email sent.
 "fail"    - Uexpected error - No email sent.

Function newgameOK(response)

Function newgameOK is the callback function for the ajax newgame call. After sending emails to all players it calls the delayGoToMain() function.

Function doNewGame()

Function donewgame is called by the on-click method of the newgame submit button. It checks the input for missing fields and invalid values. It then does an ajax call to createGame.php.