I'm learning some AJAX right now and the jQuery function that is being used to submit the form is wrapped inside $( function() { } ) as so. What does this exactly do?
$(function() {
$('.error').hide();
$(".button").click(function() {
// validate and process form here
}
});
This is a shortcut provided by jQuery for running code on page ready. It is equivalent to:
jQuery will call this function when the page is ready to be manipulated.
Docs