Ajax Call for Every Minute to Server

Scenerio : Here we needs to call a a function to server on every minute,we can use use below code.

$(document).ready(function () {
snooze();
})
function snooze() {
$.ajax({
type: “GET”,
url: ‘URL’,
success: function (data) {
},
complete: function () {
// Schedule the next request when the current one’s complete
setTimeout(snooze, 10000);
}, error: function (xhr) {
},
});