
Sajax is an open source tool to make programming websites using the Ajax framework — also known as XMLHTTPRequest or remote scripting — as easy as possible. Sajax makes it easy to call PHP, Perl or Python functions from your webpages via JavaScript without performing a browser refresh.
Thomas Lackner, of Sajax fame, was gracious enough to accept my JScript-in-ASP version of the Sajax toolkit. Sajax also has versions in Io, Ruby, PHP, Python, Lua, Coldfusion and Perl. The JScript port is still in beta, but I will be ironing out the oddities soon enough.
Essentially, you write server-side methods, choose which among them you’d like to be available from the client, and export them. The client-side code can then call the function and register a callback function. Sajax handles all of the client-server communication rather transparently.
Update (08/09/2006): Unfortunately, due to a misunderstanding, Thomas added my “beta” code into the release. There were some bugs and security issues* that I had not yet addressed and the ASP version was removed from the release. As I’m very busy now, I’d like to know if there is significant demand for the ASP version before I continue. If you would love an ASP Sajax toolkit, leave me a comment here.
Update (08/31/2006): I have completed a new alpha version of Sajax for ASP. If anyone is interested in testing it, please leave a comment here, or email me at jared@protoscript.net . I don’t want to release the files into the wild until I’m reasonably sure that everything is working.
Update (09/17/2006): I forgot to mention something. Sajax for ASP is written in JScript, Microsoft’s (mostly) ECMAScript compliant scripting language. Many people believe that writing ASP pages means writing only in VBScript. So why would I go against the grain and use JScript? That’s easy. It supports true closures; a powerful object model with the ability to use mutliple/dynamic inheritance; a convenient, powerful reflection mechanism; dynamically adding properties and methods to ‘classes’ and instances—at runtime; a nice, self-organizing, auto-growing native array type; a unified syntax for dealing with reference and value types (hence, no “set x = object” vs “x = 0”)—this vastly expands the expressivity derived from it being a dynamically typed language; Function.apply(); a terse, convenient syntax, especially for arrays construciton, regular expressions and, coolest of all, object and function literals… The list goes on and on. I cannot recommend highly enough the switch from vbscript to jscript. Once you get used to the new lanugage, and recognize that it is something alltogether different, you will find yourself far more productive.
* * *