I'm trying to understand callbacks. I have this function I found:
fetchMessages ( projectId, callback ) {
return $.ajax( {
url: `/projects/${ projectId }/messages`,
type: 'GET'
}, callback );
},
And I call that function using:
fetchMessages( this.projectId, ( data ) => {
this.messages = data.messages;
} );
I'm not understanding the callback
part. Does the callback
mean that when jQuery gets the messages then the callback
would be the result?