I have the below:
Notifications.get does exist and work in the long load of code, however at the moment its static, and I want to use ajax, however when I run
Notifications.check(somedate)
I get "undefined" and seemingly no result
var Notifications = {
DOM: {
jQueryContainer: $('#notifications-list'),
icon: $('#notifications-icon')
},
SETTINGS: {
DEFAULT: {
sleepTime: 3
}
},
check: function (date) {
Log.info('Checking for updates');
$.ajax({
url: 'api/notifications',
dataType: 'json',
type: 'POST',
data: {
date: date
},
success: function (data) {
if (data.status == 'PASS') {
Log.info('There was updates');
// there was an update, update the page
Notifications.get();
}
}
});
},
init: function () {
return this;
}
}.init();
Can anyone tell me what this way of constructing a group of functions is referred to as? (I would say class, but I don't think it is a class?), and if possible it would help to know how to use AJAX inside this. But really if I knew what this way was called I could do my own searches off that :) Thanks!