Trevor Gelowsky
|
Re: Dynamic HTML auto refresh using ds data server with slinger and qnxvar
|
Trevor Gelowsky
11/16/2012 10:22 AM
post97262
|
Re: Dynamic HTML auto refresh using ds data server with slinger and qnxvar
Hi Raymond,
If you're using JQuery to perform AJAX requests on a Slinger-hosted page, your best bet might be to write a CGI script
which returns a JSON object (or some other kind of formatted information), which JQuery can then use to update the DIV.
The qnxvar SSI is processed on the server side, and is only updated when the page is refreshed. By using a CGI script,
you can get any information you need, without needing a controller to explicitly update any global state variable.
Here's a quick tutorial on CGI scripts (in Perl, and C): http://www.jmarshall.com/easy/cgi/
The w3c schools has an excellent AJAX tutorial which may be exactly what you need: http://www.w3schools.com/jquery/
jquery_ajax_intro.asp
The Slinger documentation contains information on how to set up a cgi-bin directory where you can put your CGI scripts.
If you really wish to use ds/qnxvar, what you can do is make a simple page that just contains the variables you need.
You then have JQuery poll that page, and parse the information from the page in order to update the DIV.
In my opinion, the CGI option will perform better since it doesn't require a persistent server to update a state
variable, but really you can do whatever is most convenient for you.
Regards,
Trevor
|
|
|