Introducing AjaxSpy

Posted May 4th, 2006 in Javascript, Programming, Rails and or Ruby

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:

AjaxSpy Preview

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.

8 Responses to “Introducing AjaxSpy”

  1. a consumer writes a consumer writes Says:

    Also Firebug, if you use the ‘fox:

    http://www.joehewitt.com/software/firebug/

  2. joe martinez joe martinez Says:

    This doesn’t work for me.

    I get error: CreateEl is not defined on line 195

    Using prototype 1.5.0rc1

  3. Chris Van Pelt Chris Van Pelt Says:

    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.

  4. tomtoday tomtoday Says:

    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:

    var l=CreateEl("link");

    to:

    var l=document.createElement("link");

    perhaps you forgot to include a `function CreateEl()`?

  5. Chris Van Pelt Chris Van Pelt Says:

    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.

  6. leoxu leoxu Says:

    cool

  7. rca rca Says:

    i get strange js errors whan loading a page after installing the script

  8. push push Says:

    funn page!…full of entertainment n decent animation :)


Leave a Reply