http://www.perlmonks.org?node_id=182521


in reply to Calling Perl function and script from javascript and backwards

You could use a framework like OpenThought:
OpenThought is a powerful and flexible web application environment. OpenThought applications are different from other web applications in that all communication between the browser and the server is performed in the background. This gives a browser the ability to receive data from the server without ever reloading the currently loaded document. Data received can be displayed automatically on the existing page, can access JavaScript functions and variables, and can load new pages. Additionally, OpenThought completely manages all of your session data for you. These features give the look and feel of a full-blown application instead of just an ordinary Web page.
I've not ever used it, but I have done a similar thing, basically using a hidden frame and javascript. You call a cgi script which returns javascript code to do things.

Hope this helps..

gav^