Re: Continuous communication between user, CGI script and server



"robinp.la@xxxxxxxxx" <robinp.la@xxxxxxxxx> writes:

So I have managed to write a CGI script that processes the user's
unputs and then spits back HTML code to the user. Pretty straight
forward. What if I want the user to be able to send data continuously
to my CGI script? Like what if the user drag his mouse around and I
want to process that data every 5 seconds or something. How do I do
that?

Have a look at AJAX. In a nutshell, you have some JavaScript in your page
that periodically looks at the position of the mouse, and submits a request
to your server-side app. Your server-side app will return either XML or
JSON formatted data, which the JavaScript will then use to update the page
by manipulating its DOM.

This is what Google Maps uses, for instance, when you drag a map around in
its viewport.

Not much to do with Perl though. The server side is pretty bog-standard,
aside from returning XML or JSON instead of HTML. The hairy stuff is all on
the client - you should ask about that in a JavaScript group. Or just google
for "AJAX tutorial" to get started.

sherm--

--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
.



Relevant Pages

  • PB : document.write some HTML code with <script src=".."> tags
    ... I'm doing a script that should strip the current document to a printable ... so I've got myself a variable with this new HTML code. ... to errors in the javascript. ... Is there any way to tell IE to not mangle my code when inserting ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: Changing the onclick of an image in aspx file
    ... I need to either set the onlick after (Which ... or declare the image later and have the HTML put the ... resulting HTML code. ... Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/- Hide quoted text - ...
    (comp.lang.javascript)
  • Re: Dynamic HTML code not being saved
    ... javascript file, the problem only occurs when the program ... doesn't disappear, it just doesn't execute after closing ... function dynAnimation() ... >> problems with the Dynamic HTML code. ...
    (microsoft.public.frontpage.programming)
  • Re: javascript: in location bar
    ... I use the JavaScript Console feature from ContextMenu Extensions, ... Nonsense. ... HTML code is not script code. ...
    (comp.lang.javascript)
  • IHTMLDocument2 and IDocHostShowUI
    ... I have HTMLDocument object and I explictitly write HTML code to it ... "alert" then Javascript alert windows appears. ...
    (microsoft.public.vc.atl)