user1411803
user1411803

Reputation: 7

What is the fastest way to read XML without reloading a page?

I need to read XML values, and it will change dynamically after every 10 seconds. I need to reload it after 20 seconds without page reloading (ie: using Ajax or Jquery).

Upvotes: 2

Views: 110

Answers (1)

oleksii
oleksii

Reputation: 35925

You can go two roads here:

  1. Client polling. Your client issues an Ajax request every so often, for example JQuery get. That takes a current value of your XML document from some sort of cache. The cache is independently updated by another service, like windows service or your other application that generates this XML.

  2. Pub/sub. Your client registers for an updates, once the server determines that a file has changed, it sends a new XML document to the client. So it is a publish-subscribe pattern. I am not sure about any implementation of this in JQuery and C# but I am sure you can quickly find those. (Perhaps Comet, Web Socket or SignalR.NET (see comment) can get you relevant results, but I am not sure.)

Upvotes: 2

Related Questions