Thinking of what you want to achieve I would go with one of those approaches:
AJAX
- create a JavaScript object that handles everything within your panel
- create a handle that can show/hide the panel based on the user's action (e.g.
onclick
) - set an interval in which you check whether something on the server has changed
- if
true
use the response of this call (could be a JSON-object) to update the show the panel
- if
HTML5 WebSockets
Another possibility is to use HTML5 WebSockets. With a WebSocket you can establish a full-duplex connection between your server and the browser:
WebSocket is a web technology providing full-duplex communications channels over a single TCP connection. […] WebSocket is designed to be implemented in web browsers and web servers, but it can be used by any client or server application. The WebSocket Protocol is an independent TCP-based protocol. Its only relationship to HTTP is that its handshake is interpreted by HTTP servers as an Upgrade request.[1] The WebSocket protocol makes possible more interaction between a browser and a web site, facilitating live content and the creation of real-time games. […]
From Wikipedia.org "WebSocket"
You can find a lot of good examples and informations in this post:
What are good resources for learning HTML5 WebSocket?