if you run the code snippet below you will notice that the param value is undefined. in the final function despite adding it. is there a way to add the parameter and have it show up in the success function. is there a way to add parameters to a callback function? edit.. to avoid some confusion the parameter is not available until sendPersonDetailsToServer
function saveSuccess(param) {
console.log('save success');
console.log(param);
}
function sendPersonDetailsToServer(successCallback) {
console.log('send person details to server');
successCallback('myParameter');
}
function saveFiles(successCallback) {
console.log('save Files');
successCallback();
}
$(document).ready(function() {
sendPersonDetailsToServer(function () {
saveFiles(saveSuccess);
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>