From Post: liveRequest.js by Jeff Minard
Originally using JavaScript to parse Textile formatting from comment fields left me feeling dirty. It was quick, to the point, and usually fairly good. The problem was that it's only 100 lines of code while the classTextile.php file is over 30kb. Suffice it to say, the JS function does not cover everything.
This implementation will allow you to preview what the text will look like without a page reload according to the actualy classTextile.php file. The magic is in using XMLHttpRequest objects from JavaScript to get the results while you're not looking ;-)
Much credit is due to Bitflux GmbH for the AWESOME use of this concept way before I got to it. I have adapted his code first to do live searching for myself, and then I adapted it to be a genearl "live request" handler which is used on this page, and then ported it back to a live searching feature!
Caution! You may want to stick with the JS method, or use a button instead of the "onkeydown" event. Everytime a key is pressed and a delay of 400milliseconds goes by, a new server request is made. Thus, you can see where typing a long entry really slow could force a really large amount of page requests.