Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Implementing refresh-free SVG-perl-DBI-Javascript client-server interaction

by hackmare (Pilgrim)
on Feb 11, 2002 at 09:01 UTC ( [id://144602]=CUFP: print w/replies, xml ) Need Help??

Caution: This may be nonfunctional on NS4.7+. Tested it on IE6 earlier but now it aint working with NS4.7. Either I broke it or it's not cross-browser yet.

Here is an example of SVG (drawing XML dialect) interacting with a server through get reqests (can also do post requests). The original concept was posted on the svg-developers yahoo group in early Feb 2002, and I've adapted it to perl (of course).

The startup screen gives you 2 squares. Clicking on the squares causes a request to a database to go out which returns the xml for the drawings of the circles that fall within the square's periphery.

Key point: This is all done from within a single browser window, and with no refresh of the image.

Other key point: My server is not running mod_perl, which would make the lag about 1/2 as bad (currently it's 500mS for me, with 100 entries x 5 fields in the database, but then again the request is going 1/2 around the world for me).

Modules used:

  1. CGI (as a demo shortcut to grab the parameters
  2. SVG (for the client-DBI connection using SVG messages)
  3. CGI::Carp (this is a hosted server and I needed to see my errors sans error log access)
  4. DBI (with mySQL)

I've included the source files for inspection.

  1. click here for the demo
  2. click here for the svg source
  3. click here for the perl source

Next step: drawing onto the space and updatating the database from that.

I used SVG, but you could just as well use xmlrpc and dhtml for this.

hackmare.

  • Comment on Implementing refresh-free SVG-perl-DBI-Javascript client-server interaction

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: CUFP [id://144602]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2024-04-19 14:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found