Google Groups

Re: [Lift] Ajax without bind


fmpwizard Apr 27, 2012 9:21 AM
Posted in group: Lift
On Fri, Apr 27, 2012 at 12:16 PM, Emmanuel Eytan <eje...@gmail.com> wrote:
> Thanks! This is EXACTLY what I need. And I'm not sure I would have figured
> it out without your help.
>
> I'm still missing one last part: how I do make it do Lift stuff rather than
> client-side stuff? How can I get Ajax to call a Lift function? Do I have to
> go through actors or REST for that?
>

No actors or RESt needed here

from
http://blog.fmpwizard.com/scala-lift-custom-wizard

there is this snippet of code
https://gist.github.com/1692799

The line

info("Data confirmed!")

is code running in the lift server

so that could be the call to your

def mySuperMethod ={
  println("This is called from the web and executed on the lift server")
}

Does that make sense ?
Regards,

  Diego



> On Friday, April 27, 2012 11:58:03 AM UTC-4, fmpwizard wrote:
>>
>> You are in luck, just last night I got a really simple  sample on github
>> https://github.com/fmpwizard/ajaxInvoke
>>
>> Feel free to ask questions about it.
>>
>> Regards,
>>
>>   Diego
>>
>> On Fri, Apr 27, 2012 at 11:52 AM, Emmanuel Eytan <eje...@gmail.com> wrote:
>> > Hi. I'm at last adding some Ajax to my Lift project. But all the
>> > examples I
>> > find use bind. I was told previously on this forum that bind was
>> > deprecated.
>> > Is that also true of AjaxForm?
>> >
>> > Basically, I'm looking for a button that would do something like run a
>> > function exampleFunction such as:
>> >
>> > def render = {
>> >   def exampleFunction(a: AMappedThing) =
>> >     a.someProperty("someValue").save
>> >
>> >   "ul *" #> AMappedThing.findAll().map(a =>
>> > <li><p>{a.name}</p><button>Change</button></li>) &
>> >   "the button I just created" #>
>> > onClick(exampleFunction(the_a_that_matches_each_button: AMappedThing))
>> > }
>> >
>> > How can I generate an Ajax button for each element found that will know
>> > which element it's attached to? I was thinking of using andThen and
>> > modifying the element I just created, but that looks messy. How do I
>> > link a
>> > Lift function to an Ajax call? Do I need actors for that?
>> >
>> > Thanks.
>> >
>> > --
>> > Lift, the simply functional web framework: http://liftweb.net
>> > Code: http://github.com/lift
>> > Discussion: http://groups.google.com/group/liftweb
>> > Stuck? Help us help you:
>> > https://www.assembla.com/wiki/show/liftweb/Posting_example_code
>>
>>
>>
>> --
>> Diego Medina
>> Lift/Scala Developer
>> di...@fmpwizard.com
>> http://www.fmpwizard.com
>
> --
> Lift, the simply functional web framework: http://liftweb.net
> Code: http://github.com/lift
> Discussion: http://groups.google.com/group/liftweb
> Stuck? Help us help you:
> https://www.assembla.com/wiki/show/liftweb/Posting_example_code



--
Diego Medina
Lift/Scala Developer
di...@fmpwizard.com
http://www.fmpwizard.com