Problem on ajax call before delete an event

Hi
This is my problem:
I do an ajax call before delete an event in scheduler.
According to the result of ajax call I must delete or not delete the event.
My code is (I use prototype.js)

scheduler.attachEvent(‘onBeforeEventDelete’,function(id){
var url = ‘####url to delete evetn###’;
new Ajax.Request(url, {
method: ‘get’,
onSuccess: function(transport) {
var data = transport.responseText.evalJSON();
if (data.success) return true;
else return false;
}
});
});

My problem is that the scheduler doesn’t delete the event even if I return true.
It seems that the scheduler doesn’t wait that the ajax call ends.
Do you have some suggestions for me about how resolve this?
I have another question when I add an event or edit an event I must do ajax call to verify if the operation is valid . If it isn’t valid I must cancel the add or the edit done.
Exist a event “onBeforeEventAdded” and a event “onBeforeEventUpdate” ?
Many Thanks

Scheduler expects some value from event handler, but in your case it doesn’t return anything ( which is equal to return false ), because onSuccess method executed only after data loading, which is async.

JS code will not wait xml loading end , but continue execution while you deleting request still in processing.