Call an async action on before unload of a portlet

Hi All,

I want to call an asnyc action on before unload of a portlet, get the async response back to the portlet and perform some business logic at client side in the async action event listener.

Registering onbeforeunload event in a portlet, calling async action is working fine. But by the time the async response coming back to portlet, this portlet is getting closed (without executing action event listener code present at client side)

Is there any way I can keep the portlet window open(unloaded) till the time async response comes from the server and clientside action event listener gets executed?

Kind regards,
Raja sekhar Kintali