Rick Faircloth wrote:
I think I may try the AJAX solution, partly because I just want to get
more experience with AJAX and mostly because it seems to be the
best solution.

It's not that much harder client-side than the others. But there really is more work to do on the server...

Wait, I see what you're saying... the same link would serve both
JS and non-JS users.  How would a link that would work for both
situations be coded?

How to code the server side is way outside the domain of this list. On the client side, perhaps it could be done as simply as this (untested):

    <a class="details" href="eventDetails/?id=27">details</a>

    $(document).ready(function() {
        $("a.details").click(function() {
            $(this).parents("tr").eq(0)
                   .after("<tr></tr>")
                   .next("tr").load(this.href + "&ajax=true");
            return false;
        });
    });

This is bare-bones, of course. You would probably want an animation on the display. Once the ajax has been loaded, you would probably want to change the click to a show-hide effect on the newly loaded details row. And you would probably want to guard against re-ajaxing the same details on subsequent clicks. But I think that's the basic idea.

On the server side, your eventDetails code would need to check if the ajax parameter was set to true. If so, just return the contents of that row; if not, return a whole page.

Does that help?

  -- Scott

Reply via email to