I have developed an MVC application and want to make my button click automatic. In this I want my button to click daily at 10 p.m. automatically. This is my button in my View.
<a href="#" class="thumbnail">
<input type="submit" class="btn btn-default" id="btnAdd2" value="Add 2" />
</a>
I have googled a lot and got one such thing.
setInterval(click,3000);
function click() {
$("#btnAdd2").click();
alert("Automatic button click after 3 seconds.");
}
This is working fine but it is clicking after every 3 seconds. But I want it to click daily at 10 p.m. If anyone has idea to resolve this please help and your help would be appreciated.....Thanks.
I want to update the database daily at 10 pm
...if you want this to run consistently, every day, without user intervention, and always run even if no users are using the website at that time, then this would be far better implemented as a background task - e.g. using a windows service or scheduled task. Then it won't fail if the user isn't logged in, or is viewing another browser tab (which can cause scripts in the hidden tabs to stop running).