ajax to update state after player moves