[MAKR] 2006/10/22: I've looked into [AJAX] and what it takes to use it with Tcl on the server's side. To get started I used a good example for [PHP] from [http://www.xml.com/pub/a/2005/02/09/xml-http-request.html]. It's really easy. Most of the code involved is [Javascript]. But have a look for yourself ... #!/usr/local/ActiveTcl/bin/tclsh8.4 package require ncgi # possible content types in this example set ctx "text/xml" set cth "text/html" # Check whether the name is used already # fixed list for simplicity: Alice, Bob proc nameInUse {q} { switch -- [string tolower $q] { alice - bob {return 1} default {return 0} } } ::ncgi::parse if {[::ncgi::exists q]} { # Background operation: check query ::ncgi::header $ctx puts " checkName [nameInUse [::ncgi::value q]] " } else { # Initial call: build page ::ncgi::header $cth puts "" puts "" puts "" puts " This name is in use, please try another. " } Execute this as CGI script. Tried with IE 6.0 and Firefox 1.5... ---- Some words about the functionality ... The procedure ''nameInUse'' '''is''' the backend function. For simplicity it checks against a hardcoded list of names and returns ''true'' when it detects ''Alice'' or ''Bob'' - ''false'' otherwise. The fist call to the script should be made without parameters. The complete page is sent to the browser in this case. To understand whats happening now, observe your web server's log files. Enter a name. You can see now that whenever you release a key the browser sends a query to the server. And the server answers with a small amount of data. If you happen to enter ''Alice'' or ''Bob'' a colored box will immediately appear, informing that this name is already in use. ---- [MJ] - For a framework that abstracts away most of the javascript complexity, including browser differences, see [scriptaculous]. ---- [Stanley] - Here is cgi.tcl version: #!/bin/sh #\ exec tcl "$0" ${1+"$@"} source cgi.tcl cgi_input; if {![catch {cgi_import q}]} { cgi_content_type "text/xml"; cgi_puts "" cgi_puts "" cgi_puts " checkName" cgi_puts " $q" cgi_puts "" } else { cgi_content_type "text/html"; cgi_puts "" cgi_puts "" cgi_puts "" cgi_puts " This name is in use, please try another. " } ----- [Category Internet]