var ajaxCall = new function () {
var baseUrl = 'Home/',
getCategory = function (callBack) {
$.getJSON(baseUrl + "GetCategories", function (data) {
callBack(data);
});
}
getSubCategory = function (callBack) {
$.getJSON(baseUrl + "GetSubCategories", function (data) {
});
}
return {
getCategory: getCategory,
getSubCategory: getSubCategory
};
}();
This is a part of our front end code. I know that we are creating an object with functions and this renders flexibility. I wonder two things: 1. the new keyword - why not just leave it like var ajaxCall = function(){}; ?? 2. The () at the end of this code snippet, we do we need that?
ANY comments to newbie here is welcome. Thanks.