How can I know that a callback event has fired? I have to perform an activity after the callback event has fired, should I put the code inside the callback function or is there some other way to know when the callback has fired? Even if I put the code of the activity after the statement making the javascript request I cant be sure that the code of the activity will be executed after the callback has fired?
You have to put it in the callback function. You can do this indirectly (e.g. the callback function calls another).
How to know that a callback function has fired?
You can simply put an alert in the callback function to know whether or not it has fired.
Code inside the callback function will fire anyway.
How can I know that a callback event has fired?
do something at the end of the callback. like calling the function that should be invoked after the callback.
I have to perform an activity after the callback event has fired, should I put the code inside the callback function or is there some other way to know when the callback has fired?
There is no other way to determine if a callback has been fired.
Even if I put the code of the activity after the statement making the javascript request I cant be sure that the code of the activity will be executed after the callback has fired?
by "javascript request" do you mean "ajax request". If so I would advise at doing it this way because it most probably will be fired before the callback. At most ajax requests are per definition asynchronous (Asynchronous JavaScript and XML = AJAX). And because of that the script won't wait for the response of the request to continue with itself. That is why you should use callbacks. Callbacks make sure that some code is called after something specified had happened.