few Changes
Added another condition , click Function

added the extra condition to check whether player has his turn or not
deleted board.js
formatted
changes in onClose method
sending the data json to all the methods
dealing with json
Made few changes the way json is handled