0
How to auto update data without reloaing page?
Hello I have a little confusion I had made a chatting website I want that if anyone send anything then it should be uploaded on my webpage without refreshing I mean to say that if anyone is on my website then he can see the message without refreshing the page. (I think it can be done using Ajax)
5 Respostas
+ 2
Can you please tell me why it is not good practice.
On sending the page auto refresh but I want that it keep updating
0
try to look for REST API first.
https://www.sololearn.com/learn/10391/?ref=app
for auto update, you can use setInterval and ajax call
0
You could do a simple function that does an ajax-call whenever you hit 'send'. This is probably not best practice, but I'm assuming it's a small project.
0
Taste can u please write code for me
0
I don't truly know if it really is good or bad practice, but I would assume it is a bad practice if you are going to have a lot of users, since the onclick ajax-call is going to be executed every time someone clicks on it. Imagine if you have several hundred people clicking the button multiple times. It could break or slow down your program. I would assume a good practice would ensure that each request would be handled a bit more delicate, but I cannot answer your question on good practice since I've never worked on a project with a huge user base.