Introducing AjaxSpy
While playing with the new RJS templates in rails, I found it difficult to know what was actually being returned from my requests. Thus, AjaxSpy was born. It’s a simple JavaScript and CSS file. All you need to do is include the js file in the header of your document, the css is automagically included (must be in the stylesheets directory). The script relies on Prototype 1.5.0rc0, and for it to be sexy you need the Scriptaculous effects library. You can include it conditionaly based on params in the query string, or do some fancy session stuff. That’s all up to you. This is what I’ve been doing
<%= javascript_include_tag "prototype", "effects" %>
<%= javascript_include_tag "debugger" if params["debug"] %>
The script is currently only working with Firefox and Safari, I’ll work on the bastard child that is IE down the road. Here’s what it looks like, syntax highlighting and all:
I present to you, AjaxSpy:
Again, to install simply include the js in the layout, it automagically includes the css (as long as it’s in a directory named “stylesheets” relative to the site route). Let me know if you have any problems.









May 9th, 2006 at 06:19 AM
Also Firebug, if you use the ‘fox:
http://www.joehewitt.com/software/firebug/
May 9th, 2006 at 07:35 AM
This doesn’t work for me.
I get error: CreateEl is not defined on line 195
Using prototype 1.5.0rc1
May 9th, 2006 at 09:58 AM
Firebug is amazing, I can’t believe I hadn’t seen it yet. The one place where Ajax Spy shines is in the formating of the returned text. Plus it’s sexy as hell…
As far as the bug Joe. I’m running 1.5.0rc0 and all is good. Take a look at line 195 of prototype, if you see a CreateEl change it to CreateElement.
May 9th, 2006 at 10:52 AM
Hey thanks for this wonderful tool.
I had the same problem as Joe. Running prototype 1.5.0_rc0 (my app is edge rails) I get the same error: CreateEl is not defined on line 195 debugger.js. Changing to CreateElement does not fix it.
I had to change line 195 of your script from:
to:
perhaps you forgot to include a `function CreateEl()`?
May 9th, 2006 at 11:00 AM
Sorry ‘bout that. I made some changes yesterday to fix Safari, and I had some cache issues so I didn’t see that the script was broken. I updated the code with the fix, should be good now.
July 8th, 2006 at 03:17 AM
cool
July 26th, 2006 at 07:41 AM
i get strange js errors whan loading a page after installing the script
February 17th, 2008 at 12:52 PM
funn page!…full of entertainment n decent animation :)