function testGetData(action = '') {
$.ajax({
url: options.urlTo,
type: 'POST',
success: function() {
if (action === 5) {
return 'result data here';
}
}
});
}
function getDataPagi(action, calBack) {
if (typeof calBack === 'function') {
return calBack(action);
}
}
var testPageResult = getDataPagi(5, testGetData);
console.log(testPageResult);