in javascript how to send request some url at a partcular time(e.g daily 5 pm).........
very day @5pm i have to send some request (url)e.g sending emails how to do in java script
in javascript how to send request some url at a partcular time(e.g daily 5 pm).........
very day @5pm i have to send some request (url)e.g sending emails how to do in java script
You really don't want to do it this way. If you have access to the server take a look at scheduled tasks (for windows) or cron jobs (for linux).
If you absolutely have no other alternatives the only way to accomplish this would be to create a loop with setInterval and check the current time in every iteration. But I just cringed writing that.
I am going to hazard an answer anyway:
setTimeout(function(){
//payload here
}, 3600000*24); //one day. Launch at 5pm :)
This is quite simple and ugly, you probably want to add more detail to the condition (minutes, etc)
Another solution:
var now = new Date();
// 17 o'clock today
var target = new Date(now.getYear(), now.getMonth(), now.getDay(), 17);
setTimeout(function(){
// do stuff
}, target.getTime() - now.getTime());
But regarding your question this is not a convenient solution. It means that you have to have the JS code running the whole day (with my example you even have to reload the code every day). A cron job is really a much more appropriate solution. There are also free cron job services on the internet.