Newbie Q: how to append html on ajaxForm submission

74 views
Skip to first unread message

Lukasz Kuczera

unread,
Mar 5, 2010, 3:57:59 AM3/5/10
to Lift
Hi Folks,
I've hard time to figure out how to append html snippet after ajaxForm
is submitted. I know how to make it in jQuery but i would prefer to
have it in one place. My code is: http://pastebin.com/wgAXd2ag

I would love to have AppendHtml(afterId: String, body: NodeSeq)
method.

Lukasz Kuczera

unread,
Mar 5, 2010, 5:00:43 AM3/5/10
to Lift
So i've solved it on my own :D Using jQuery in Lift :D
Lift is so complex but once you wrap your head around it is so easy :D

http://pastebin.com/J5msUQ56

ced

unread,
Mar 5, 2010, 5:04:15 AM3/5/10
to Lift
There is an AppendHtml object in net.liftweb.http.js.jquery.JqJsCmds
that generates a JsCmd.
AppendHtml("my-element-id", <span>append me</span>)
Is this what you're looking for?

Lukasz Kuczera

unread,
Mar 5, 2010, 5:53:36 AM3/5/10
to Lift
Thanks ced, I've used something like: JqId("new-comment") >>
JqAppend(<p>Posted By: {author}<br/>{text}</p>)
But AppendHtml is more eye pleasant :)

David Pollak

unread,
Mar 5, 2010, 11:51:53 AM3/5/10
to lif...@googlegroups.com
On Fri, Mar 5, 2010 at 2:00 AM, Lukasz Kuczera <kuk...@gmail.com> wrote:
So i've solved it on my own :D Using jQuery in Lift :D
Lift is so complex but once you wrap your head around it is so easy :D

Glad you found the answer... and yes... it's good to build your own JavaScript helpers for Lift.  Most of the JavaScript stuff that's currently in Lift is based on the helpers I and some other committers have used... thus they are not complete.

More generally, there's no need to prefix your email subjects with "Newbie".  We're all newbies on this list.  I asked a "newbie" question about json yesterday and I've got more Lift experience than anyone else with Lift. ;-)

Please ask polite questions (and yours are).  Please help others when you know the answer.  Please help make this community better!
 

http://pastebin.com/J5msUQ56

On Mar 5, 9:57 am, Lukasz Kuczera <kuk...@gmail.com> wrote:
> Hi Folks,
> I've hard time to figure out how to append html snippet after ajaxForm
> is submitted. I know how to make it in jQuery but i would prefer to
> have it in one place. My code is:http://pastebin.com/wgAXd2ag
>
> I would love to have AppendHtml(afterId: String, body: NodeSeq)
> method.

--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.




--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics
Reply all
Reply to author
Forward
0 new messages