Quantcast

Comments box with datetime and AJAX?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Comments box with datetime and AJAX?

bigal.nz
Hi All,

I am using TH and Springboot - A bit of background on what I am trying to do:

I want to setup a webpage which has an area where authenticated users can submit comments like:

+---------------------------------------------------------------------------------+
| 12/04/2017 08:01 John SMITH - Fun Department : This is comment1. |
| 13/04/2017 15:00 Mary DUCK - Safety Department : We are kill joys.  |
|
|
+----------------------------------------------------------------------------------+

Input box
+----------------------------------------------------------------------------------+
|
|
+----------------------------------------------------------------------------------+
                                                                                   [SUBMIT BTN]

This area should be read only, fixed size and ability to scroll vertically.

Below it an area where users can enter new comments. (Note there will only be about 3/4 comments each of 1-2 lines.

I am thinking i really need to store each comment seperatley in the database along with the datetime and user who made the comment. I don't want to have to refresh the whole page each time a comment is submitted.

Whats the best way to acheive this? I was thinking with AJAX and having a seperate endpoint listening for new comments (The controller would then append datetime and user).

I am a bit unclear on how the browser would then get this update and what happens when the final page close submit button is pressed since the comments object will already be up to date?

Hope this is clear?

AL
Loading...