[Seaside] append listItems to an unordered list using aQuery load html:

Lukas Renggli renggli at gmail.com
Tue Feb 23 19:15:22 UTC 2010

> I'm trying to append some listItems in an ajax response to an unordered
> list. If I use
> (html jQuery: 'li:last') load html:
> it works fine except that the new content is inside the list item
> rather than replaced by it.

This is what the documentation says:

    "Load data from the server and place the returned HTML into the
matched element."

> Using #after: or #replaceWith: generates
> an "unterminated string literal" error

I can't find such an error in my image. I would assume that you get a
"Message Not Underderstood", because JQLoad does not understand
#after: or #replaceWith:.

> I could just
> reload all of the content in the ul from a collection of objects, but
> I'd prefer to just append the new ones to the existing ones in the
> DOM.
> Is there any way to do that using "aQuery load html:"?

No, as the JQuery documentation says it *places into the matched element*.

You can however use a custom AJAX function, something along with what
you find in JQAjaxFunctionalTest:

    html submitButton
        onClick: (html jQuery ajax
	     script: [ :s | s << (s jQuery: 'li:last') after: [ :r | ... ]);
	with: 'After'


Lukas Renggli

More information about the seaside mailing list