I just briefly looked at JPSpan. Looks interesting for mating up PHP variables with Javascript.
Not exactly the same, but I cheated with my click tracker (Firefox only, not IE friendly, may or may not work in other browsers). PHP is requested by dynamically adding a new javascript file request to the HTML page. The contents of the javascript file get executed immediately once loaded. So I just have PHP dynamically generating the Javascript file as needed (which for this click tracking toy isn't difficult). For this toy, click on the Track Update button and the script comes back and draws the dots on the screen where people clicked (with IP addresses being in different colors, but I haven't fully tested this). I would figure this could also be done with JPSpan.