Return before aplication inside ajax event

I have a grid app. it has an ajax event. I want that the user click onto the field. the ajax event does several task, in the end close window( return into previous application)
sc_exit() not work
I tried put javascript code
$(’#"sai_top’).click(); sai-top is the id of the return button but It didn’t work

Is there any way to execute javascript inside ajax event , or other methos to close the window.?
thanks

I hope this can help:
To exit and open another application.
Some Field;
Ajax event;
Onclick;
sc_redir (‘your_app’);

thanks. it does work