That's a very simple example, but imagine a more complex situation
where you want to have polymorphic functions on a list of results.  Or
where the functions are lift ajax calls.

Like this:
[{name:"marius", poke:function(){liftAjax...}}, {name:"dpp",
poke:function(){liftAjax...}}]

- Jon

On Feb 3, 3:46 pm, Marius <marius.dan...@gmail.com> wrote:
> Hmmm ... in Lift we do use JSON structures with functions (but not
> with JSON mime type). For instance ScriptRenderer.scala defines a JSON
> with functions. jlift.js also defines a JSON with functions.
>
> But looking at your example app, you're using JSON mimetype in the
> response and that JSON has a function which I don't think it is
> correct. So why do you need the jsonCall stuff with AjaxContext.json ?
>
> Br's,
> Marius
>
> On 3 feb., 22:08, David Pollak <feeder.of.the.be...@gmail.com> wrote:
>
>
>
> > On Wed, Feb 3, 2010 at 11:55 AM, Jonathan Hoffman 
> > <jonhoff...@gmail.com>wrote:
>
> > > I was able to find the root cause.  jQuery 1.4.1 does not consider
> > > javascript objects that contain functions to be be valid JSON.
>
> > According the to JSON spec, a function is not valid JSON.
>
> > > This is ok: {"foo":"bar"}
> > > This is bad: {"foo":function(){alert('hello')}
>
> > > jquery-1.4.1.js:491 --> parseJSON
>
> > > jquery 1.3.2 simply eval'd strings to created json objects, so there was 
> > > no
> > > problem.  I think it's kind of nice to be able to return JSON objects via
> > > ajax calls with embedded functions, but please feel free to educate me if
> > > you think that's a bad idea.
>
> > I think it's a nifty trick, but I'm not sure it's optimal.
>
> > Is it a Lift thing or your app that's returning the function as part of the
> > JSON response?
>
> > > I'll also try to get some feedback from the jQuery forum.
>
> > > Thanks,
>
> > > Jon
>
> > > On Feb 3, 2010, at 2:21 PM, Jonathan Hoffman wrote:
>
> > > > Hi,
>
> > > > There is a problem with making jsonCalls which return JSON with 
> > > > anonymous
> > > functions.  I've created a very simple reproducible example, but have not
> > > been able to track down the root cause.
>
> > > > Take a look at jsonCallBug in:
> > >http://github.com/hoffrocket/lift_1_1_sample/blob/master/src/main/sca...
>
> > > > The project should run in mvn or sbt.
>
> > > > Thanks,
>
> > > > Jon
>
> > --
> > Lift, the simply functional web frameworkhttp://liftweb.net
> > Beginning Scalahttp://www.apress.com/book/view/1430219890
> > Follow me:http://twitter.com/dpp
> > Surf the harmonics

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

Reply via email to