On Wed, Feb 3, 2010 at 11:55 AM, Jonathan Hoffman <[email protected]>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/scala/com/liftcode/snippet/Hello.scala
> >
> > The project should run in mvn or sbt.
> >
> > Thanks,
> >
> > Jon
>
>
--
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
--
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.