Closed
Description
Reading this section of how Jquery Works i think the example could be enhanced.
Programmer should not now how will the get function use the callback function, so it is possible that get will use its return value. In that hypothetical case, this example will fail.
Always use return
when wrapping a callback function like that because it will satisfy both cases:
- Returning values functions
- Non returning values functions.
So i suggest modifying the "Right" example with the following:
$.get( "myhtmlpage.html", function() {
return myCallBack( param1, param2 );
});
(It just add a return before the callback call).
Metadata
Metadata
Assignees
Labels
No labels