In the application I'm viewing, an external javascript file is loaded, which looks like this:
$(function () {
$.ajaxSetup({ cache: false });
var dialogs = {};
var getValidationSummaryErrors = function ($form) {
...
...
}
return errorSummary;
};
I understand that the file configures some variables, and also declares a function called getValidationSummaryErrors.
I do not understand why this is all inside
$(function () { ... }
What is the purpose of this? Can I just declare a variable and things inside a flat file without the $ (function () {} "function?
source
share