var updateWidgets = (function() {
var UPDATE_WIDGETS_INTERVAL = 10000,
containers = {
nps: $('#nps-widget-container'),
feedback: $('#feedback-widget-container')
};
return function() {
setTimeout(function() {
$.ajax({
url: "URL",
type: "GET",
dataType: "json"
}).done(function(data) {
$.each(containers, function(name, $container) {
if (data.hasOwnProperty(name)) {
$container.html(data[name]);
}
});
}).always(updateWidgets);
}, UPDATE_WIDGETS_INTERVAL);
};
})();
var UPDATE_WIDGETS_INTERVAL = 10000,
containers = {
nps: $('#nps-widget-container'),
feedback: $('#feedback-widget-container')
};
return function() {
setTimeout(function() {
$.ajax({
url: "URL",
type: "GET",
dataType: "json"
}).done(function(data) {
$.each(containers, function(name, $container) {
if (data.hasOwnProperty(name)) {
$container.html(data[name]);
}
});
}).always(updateWidgets);
}, UPDATE_WIDGETS_INTERVAL);
};
})();
Comments
Post a Comment