views:

44

answers:

1

I have a series of images, and I simply want to record when each is clicked. They never show up in their own view, so running the code there is worthless.

I've wired up a click event using jQuery. Though the $.post doesn't work. Any idea how I can achieve what I am trying? The 'hit' is just an HTML element stored in the view when it draws the link for the image. Hit refers to HitController, and then the "Hit" method accepts an id.

Yeah, I fixed the id error - still not working though.

    $("a[hit]").each(function() {
        $(this).click(function() {
            var hit = $(this).attr("hit");
            $.post("Hit/Hit/", { id: hit });
        });
    });
A: 

hmm, id could possibly be an undefined variable, does alert(id) show the proper result?

jspcal
Yes, alert(hit) does show the proper result. The $.post is not firing.
Stacey
The problem was missing / before the controller name.
Stacey