I have designed a form where the user can enter his comment using “Add Comment” button.
whatever comment user enters is added to the list of Comments on the page.
I am appending new comment using “appendTo()” function. but whenever I refresh the page all the comments added using “appendTo()” function are lost.
My question is, is there any way to retain the comments even after “Page Refresh”?
Any hint or a demo example would be very helpful.
Thanks in advance..
I have designed a form where the user can enter his comment using Add
Share
No you can’t. If you “save” the data only in the client side it will not be saved after Page refresh. HTTP is stateless. once the response reached the client, the server doesn’t “know” the client anymore.
If you want the comment to be saved, You will have to use some sort of Data Base that stores the comments.
Additional to the appending you should make an
AJAXpostrequest to add the comment to the server.