Ajax

Ajax stands here for Asynchronous JavaScript and XML.

http://www.adaptivepath.com/publications/essays/archives/000385.php is an pretty informative article on how Ajax works.

Ajax is an Rich Internet Application framework that uses Javascript, but not Flash to achieve interactivity at the client.

- Zarutian 7. august 2005

DKF: It's actually a pseudo-framework. The AJAX model is supported by many different frameworks, and as long as your server can talk XML (typically a trivial task!) you're at least potentially in the game. The real complexity is that you have to deal with many different and inconsistent browsers (especially IE6...)


To add AJAX functionalities in your TCL web scripts:


escargo 26 Sep 2005 - Is there infrastructure in place to use Tcl in the same way as Javascript? It seems like Tcl (using the Tcl/Tk Tclet Plugin) could accomplish much the same thing. Would it be necessary to use the XMLHttpRequest object?

It would be nice to be able to demonstrate AJAX-like behavior in Tcl.

schlenk 26 Sep 2005 - With the Tcl Plugin you don't need all the XML mumbo jumbo, just open a socket back to the original server or do some http requests via the http package to get the dynamic info you want.

Doing AJAX with Tcl is a matter of ripping of the JavaScript part for the browser side and doing some XML processing on the server side, be it with Aolserver, Tclhttpd, Rivet or one of the other things. Not too hard to do (I have a XUL based JavaScript app as a Mozilla browser sidebar talking to tclhttpd via Mozillas Javascript SOAP-API, very similar stuff)

(escargo - Could you clarify what you mean by "ripping of the JavaScript part"? Perhaps, "ripping out"? If it is ripping out, do you know what you would replace it with? The XMLHttpRequest object seems to be a JavaScript (or ActiveX) thing. I don't know if we have (or need) an equivalent.

schlenk - With the Tcl Plugin you do not need this XMLHttpRequest object, just use the http package with the -command option and fetch pages from the server the plugin code is loaded from and update the things displayed in the plugin accordingly. Basically AJAX is just a limited RPC mechanism for JavaScript which runs in a browser while displaying a web page. All those AJAX frameworks just provide a) a server to answer XMLHttpRequests, b) JavaScript code to issue XMLHttpRequest with minimal coding, c) some HTML generation support to plug things together. Part a) could probably done with tclhttpd and tdom quite fast, part b) can be adapted directly from other frameworks, part c) would be an extension for something like tcllib::html or Rivet to be useful.))

LES same day: open a socket and leave it open for as long as the browser window is open? For each visitor? Then I suppose a few thousand open sockets could accumulate in just a few minutes if the site is popular enough. I imagine the impact on the server's performance.

schlenk it really depends. Having a socket open would mean the server can push information to the client. Doing HTTP means polling by the client. So just open sockets do no real harm (some small amount of memory), but the limited amount of ports will eventuell hit). As there is no simple way to increase the number of available ports but it is simpler to increase the computing power of the server so it can serve many more empty polling requests its probably the way to go. Especially as most AJAX apps are inherently: user sends data to server and gets update and not something like stock tickers etc. where the server would like to push data. Its more an RPC thing.

TP See Comet, an Ajax technique that keeps sockets to browsers open: [L1 ] [L2 ] [L3 ]

Also: google for the terms "reverse Ajax" and "long polling" for ways to overcome latency and overhead in push scenarios -jcw

[When CL makes the time, he'll complement the descriptions above with a security-oriented one 'bout how Tcl does more than Ajax, but mostly has a different security profile. Michael correctly highlights the JavaScript-Java restriction to connections back to original server (or ...).]


See also: