0

How to get data from SQL database without refreshing using Ajax with xmlrequest or fetch method, When I insert data or update it from SQL table how i can see this change without refresh or press any button

Please I need exemple with node JS server and EJS client page to resolve this problem

Assem
  • 11,574
  • 5
  • 59
  • 97
  • You can use polling or websockets, so search for some examples. – NikNik Apr 15 '19 at 12:59
  • Yo are basically looking for web-sockets. You can also achieve this using long-polling. You can [read more](https://stackoverflow.com/questions/11077857/what-are-long-polling-websockets-server-sent-events-sse-and-comet) about them – Sujit Kumar Singh Apr 15 '19 at 13:01
  • depending on how important it is for your application to always have the latest data right when the SQL-database changes, it might just be sufficient to to make a request in a fixed interval. AJAX should never refresh your page, if that's what you mean. – Rob Apr 15 '19 at 13:50

0 Answers0