Sajax is an useful ajax framework to simplify ajax based development for languages like PHP, Ruby etc. Not many realize Sajax can be used equally well from plain old html pages (as in .html or .htm). Their website doesn’t mention it anywhere so I can guess it was not one of their use cases. However sajax is based upon ajax which is plain old Javascript. Let’s find out how we can use trusty old sajax to liven up your static pages.

To use sajax from html you need to get the javascript code it generates and include it in your html pages.
Sajax doesn’t tell you how you can create a javascript file to include (in your html pages), thereby allowing you to call php (for example) function calls from client side javascript. This can however be remedied with a simple call:

This generates the required javascript file (change filename to your liking). Include this file in your html pages and you are good to go. Now you can call your exported php function from javascript. Remember to append the function names with x_.

How can you use it?
Check my Annotated wordPress source code cross-reference site for an example. Check out the sajax based commenting system.

PS. As a side tip you should know sajax_init() function call is not required and can be eliminated with current versions of Sajax. It does nothing.