M_M
M_M

Reputation: 61

Timer like functionality for web api

Is there a way to have a timer like functionality so I can call the web api to get the updated records every second?

for example I have this web api

[httpget]
public IList<Details> GetUpdates()
{

return details;
}

I need to call this api every second so I can display the updated records on my web page.

Upvotes: 0

Views: 392

Answers (1)

Hitesh Anshani
Hitesh Anshani

Reputation: 1549

On front-end Part, you can use Ajax which will call in every 15 minutes or whatever your requirement based on that you can increase or decrease time.

var ajax_call = function() {
  //your jQuery ajax code
};

var interval = 1000 * 60 * Xy; // where Xy is your every Xy minutes

setInterval(ajax_call, interval);

Upvotes: 3

Related Questions