I have a problem with callbacks. I'm using semantic and i want a callback to be fired to do something on response (onResponse).
I can make it this way and it works:
var drop = $('.ui.dropdown');
drop.dropdown();
drop.api({
action: 'someAction',
on: 'now',
onResponse: funcion(response){
//do some operations using the response variables AFTER the server
}
});
But i want to do it this other way:
var drop = $('.ui.dropdown');
drop.dropdown();
drop.api({
action: 'someAction',
on: 'now',
onResponse: func(response)
});
function func(response) {
//do some operations using the response variables AFTER the server responses
}
As you may have noticed, the second way is erroneous because the function is doing it's operations before the response variable get's fulfilled.