0

I have 5 messages and below the messages there is a combobox for the user to post a new message in my browser. now the user posted a new message so as i dont want to refresh the entire page i have intiated an ajax call. so i am sending the message to the server via ajax and on the server my web app stores the message into the database. up to here i am clear.

now after saving it into the database without any additional hit to the database can i send the message back to the client?

what i am doing is, after storing the message into the database i am fetching it back again from the database and sending it to the client.

what is the right approach? how to do it?

4

1 回答 1

0

这取决于您使用的技术堆栈。在 JSF 中,您会告诉显示先前消息的表格组件在发布新消息时自行刷新。这样,您可以部分刷新受 AJAX 调用影响的页面元素。

于 2013-02-09T07:05:29.813 回答