Custom Form Cancel Button and Temporary Event

I’m using my own custom form to create event. I’m opening form in Jquery UI Dialog. The issue is when I press cancel button from Jquery UI Dialog, the temporary event (unconfirmed added event) stays in calendar. I want my cancel button to work same like built-in lightbox. Following is the code

scheduler.showLightbox = function(event_id){

You can add the next call to custom cancel action


Where id - id of event which creation was canceled.