I'm planning on using the Form plugin for an AJAX submission, where
when the callback function is fired, it adds the returned data just
before my the content form. Fairly standard right? Here's my HTML
code:

<div class="commentShell">
        <div class="openComments">Comments <i>(3)</i></div>
        <div class="comments">
                <div class="singleComment">
                        <p>I know...he's so poetic isn't he? Noelle HAS been 
really cute
lately too.</p>
                        <i><a href="http://www.andyandjaime.com"; 
target="_blank">Jaime
Matthews</a></i> <i>- August 23, 2007 07:25 pm</i>
                </div>

                // insert new comment right here

                <div class="commentForm">
                        <form name="addcomment" action="comment.cfm" 
method="GET">
                                Your Name: <input type="text" name="visitor"
class="commentInput"><br>
                                <input type="submit" value="Speak!" 
class="speak" style="font-
size: .9em;">
                        </form>
                </div>

        </div>
</div>


And here's the snippet of jQuery code
$('.commentForm form').ajaxForm(function(data) {
        alert(data.split('!!!')[1]);
        // $('.commentForm').before(data.split('!!!')[1]);
        $(this).fadeOut();
});

This sounds weird but, I don't know what $(this) is in the context of
the jQuery function. I "thought" that it would be the form itself but
I've tried various things and I can't get ANYTHING to respond.
Everything I try comes back as undefined. So the problem is that I
can't use the .before() method because I don't know where I am in the
document when the user submits the form.

Can someone shed some light please? Thanks.

Reply via email to