0

I want to know how can I reflect the change on the HTML as soon as the data changes on the database.

I am aware that I could poll the php file with setInterval function to periodically check if database value changed. However I am interested to know if it could be done without the setInterval function?

Presently the app uses jquery library and PHP backend.

thanks for any help in advance.

Based on the comments below and more research Accessing socket.io server via Apache served pages Accessing socket.io server via Apache served pages

I understand I need to have a node package running on my server to work with socket.io or websocket.io. I cannot take the liberty of installing it since I am on a VPS.

Therefore, its best to use Simple long polling example with JavaScript and jQuery as a snippet to my situation

7
  • 1
    This may help you, stackoverflow.com/questions/3583203/… Commented Nov 23, 2013 at 17:45
  • @RajaprabhuAravindasamy Doesn't AngularJS have an alternative for this? Are you familiar with it? Commented Nov 23, 2013 at 18:04
  • 1
    Have you tried websockets? en.wikipedia.org/wiki/WebSocket Commented Nov 23, 2013 at 18:44
  • 1
    Only way to do this without polling is with websockets. Commented Nov 23, 2013 at 18:54
  • @Claudix and levi, I was just toying with them.. Anyway, once I am done.. I will post my answer.. Cheers! Commented Nov 23, 2013 at 19:14

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.