Yes, you can show it via client-side API. Two possible options to deliver script to the client in AJAX request:
1. Pass script text into AjaxContext#setOncomplete (this will overwrite previously-defined script)
2. Place inline script code on the page and re-render this part, e.g.:
As far as I remember, photoalbum demo application uses the second approach.