Hi Brandon,
I tried to do that, but it breaks the ajax effect - clicking submit
just does an HTML post to the server php program:
    $('.deleteform').livequery('submit', function() {
        //$('.deleteform').submit(function() {
                var gthis = this;
                var delformData = $(this).serialize();
                //function() {echo "hello"; }
                $.post('eatchoices.php', delformData, delprocessData);
                function delprocessData(data) {
                $(gthis).parent().html(data);  // get the parent of the form
so replace just below the date
                }  // end of delformData
            return false;
        }); // end of submit delete form

I am stumped and confused,
Jamie


On Sep 16, 10:03 pm, "Brandon Aaron" <[EMAIL PROTECTED]> wrote:
> Replace the first line
> $('.deleteform').submit(function() {
>
> with this
>
> $('.deleteform').livequery('submit', function() {
>
> --
> Brandon Aaron
>
> On Tue, Sep 16, 2008 at 8:30 PM, onmountain <[EMAIL PROTECTED]> wrote:
>
> > Can I use livequery with ajax?  For instance, I am adding and deleting
> > elements of a certain class that have .post associated with them
> > at .ready.
>
> > For instance, if my last .post returns new html that create more items
> > with delete forms, how should I turn the code in the .ready below to
> > work?
> >        $('.deleteform').submit(function() {
> >                var gthis = this;
> >                var delformData = $(this).serialize();
> >                $.post('eatchoices.php', delformData, delprocessData);
> >                function delprocessData(data) {
> >                        $(gthis).parent().html(data);  // get the parent of
> > the form so replace just below the date
> >                }  // end of delformData
> >            return false;
> >        }); // end of submit delete form
>
> > On Sep 15, 4:11 pm, "Brandon Aaron" <[EMAIL PROTECTED]> wrote:
> > > Typically with tables you want to do event delegation for performance
> > > reasons. However, this is how you'd do it with LiveQuery.
> > > $(document).ready(function() {
> > >     $('table tbody td.hasContent')
> > >         .livequery('mouseenter', showBox)
> > >         .livequery('mouseleave', hideBox)
> > >         .livequery('mousemove', position)
> > >         .livequery('click', showDetail);
>
> > > });
>
> > > You could also do a function based livequery like this:
>
> > > $(document).ready(function() {
> > >     $('table tbody td.hasContent')
> > >         .livequery(function() {
> > >             $(this)
> > >                 .bind('mouseenter', showBox)
> > >                 .bind('mouseleave', hideBox)
> > >                 .bind('mousemove', position)
> > >                 .bind('click', showDetail);
> > >         });
>
> > > });
>
> > > The mouseenter and mouseleave events are what the hover helper method use
> > > behind the scenes.
>
> > > --
> > > Brandon Aaron
>
> > > On Mon, Sep 15, 2008 at 11:49 AM, jwynne <[EMAIL PROTECTED]> wrote:
>
> > > > Currently I am using $(document).ready to bind some behaviours to
> > elements
> > > > in
> > > > the DOM based on a class name (using jquery's .filter) - This works
> > great
> > > > on
> > > > the initial load of the page however these bindings get all screwy when
> > I
> > > > try injecting or editing new elements to the DOM dynamically via AJAX.
> > > > After researching the issue I have been trying to use the livequery
> > plug-in
> > > > but have been unsuccessful so far.
>
> > > > In $(document).ready I am assigning behaviour to td elements of the
> > class
> > > > "hasContent". I am looking to hook them up to livequery listeners so
> > that
> > > > the correct behaviours are assigned when the DOM is updated.
>
> > > > $(document).ready(function(event) {
>
> > > >        var position = function() {
> > > >                }
> > > >        var showBox = function() {
> > > >                }
> > > >        var hideBox = function() {
> > > >                }
> > > >        var showDetail = function() {
> > > >                }
>
> > > >        //Syntax help below
> > > >        $("table tbody td").filter(".hasContent").hover(showBox,
> > > > hideBox).mousemove(position);
> > > >        $("table tbody td").filter(".hasContent").click(showDetail);
>
> > > > });//EOF
>
> > > > Can anybody help me with the syntax necessary to get livequery to
> > > > bind/unbind the necessary behaviours to the table tds?
>
> > > > Thanks for the help.
> > > > --
> > > > View this message in context:
> > > >http://www.nabble.com/jquery-livequery-assign-behaviour-to-element-by.
> > ..
> > > > Sent from the jQuery General Discussion mailing list archive at
> > Nabble.com.

Reply via email to