Look at the attached image. It has been taken from Google's Calendar, Event.
To see it, go to [url removed, login to view], create an event and you would see it at the bottom of the screen "Discuss this event".
2. Prototype of all backend (server side) functions need to be defined, with well defined input parameters and the expected output for these functions.
3. A dummy code for server side to test and emulate this functionality.
A brief explanation of the functionality:
- On clicking "Discuss this event"
1. It toggles the display of comment section.
2. When expanding the comment section for the first time, it makes an AJAX call to fetch all old comments from the server and subsequent expansion just displays what has been fetched earlier and cached.
- In comment section, it first shows a textarea to add a new comment, followed by list of old comments with their usernames/emails.
- On clicking "Add a comment" toggles the display of the section to add the comment.
- When a new comment is added and "Post Comment" is selected, it makes an AJAX call to save the comment on the server and also adds it to the old comments for subsequent display.
For best understanding of the functionality, look at the event details in [url removed, login to view]