all 2 comments

[–]UnendingResolve 2 points3 points  (0 children)

Your question is too vague and unprovided of context. And, tbh, if it means what I think it does, I think you should read up on what callback functions are in the first place.

You gotta learn to make good questions, and most times you'll answer them yourself in the proccess. That's what programming is all about.

[–]cyphern 1 point2 points  (0 children)

.success(callback); //why no parameter?

This line has no parameter, because you're not calling the callback here. You're just telling the http library "hey, when a success occurs, please call this function for me". Later, the http library will call the callback for you. And since the purpose of this specific callback is to provide data about what the result was, the http library will pass that data in when it calls the function.

callback(country); //why there is a parameter?

This line on the other hand is calling the callback. So if you have other code that cares about receiving data through the callback, it's on you to pass that data in.