The whole point is to understand how computers should communicate with each other using javascript (no jQuery framework) and ajax (by using XMLHttpRequest). I have a memory game and I would like to add an online option for people so they can play with their friends. I was thinking about a peer 2 peer connection, but I didn't know how exactly and that is why I posted this question (I am sorry if my question is not meant to be here). This is what I had in mind:
User 1: 1. click->sendAction to server
Server: 1. receiveInfo->saveDetailsInDB 2. packReceivedInfo->send to User 2
User 2: 1. receiveInfo->updateDetails
Edit: Thanks to fstanis, I now know that I should use a WebSocket method in order to communicate users/computers with each other.