To add to Derek's explanation, if you want to keep some server-side state
that gets updated with AJAX calls, take a look at some of the stuff in
liftweb/sites/example. You can use a SessionVar (as in Count.scala) or a
StatefulSnippet (as in CountGame.scala or ArcChallenge.scala).

--j

On Wed, Oct 22, 2008 at 1:27 PM, didi <[EMAIL PROTECTED]> wrote:

>
> Hello,
>
> im Playing around with Lift Snippets and die Ajax Examples provided in
> the Demo.
> I've learned from the FAQ the a Snippet default lives for a request
> time.
>
> Now i have following Ajax example:
>
> class HelloFormAjax {
>  def sample = {
>    var cnt = 0
>
>    <span>
>    {
>      a(() => {cnt = cnt + 1; SetHtml("cnt_id", Text( cnt.toString))},
>          <span>Click me to increase the count
>     (currently <span id='cnt_id'>0</span>)</span>)
>    }</span>
>  }
> }
>
> Here is what i observed using Java Remote Debugger connecting my
> Eclipse to Jetty:
>
> The cnt = 0 expression is executed once a request (Reload of the
> Browser Page).
>
> Now I wonder where the cnt var lives during the Ajax calls.
>
> Thanks
> Christian
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to