[Seaside] Re: passing json between seaside and javascript

Johan Brichau johan at inceptive.be
Sat Jan 17 08:26:08 UTC 2015


The JQAjax>>callback:json: method is in the Seaside3.1 codebase... it’s in the JQuery-JSON package.

Check what packages you have loaded… the basic load for Seaside 3.1 does not load jQuery nor json…
Something we will probably change in the near future, but for now this is the case.

Johan

> On 16 Jan 2015, at 21:50, Paul DeBruicker <pdebruic at gmail.com> wrote:
> 
> Umm you could paste it in your image for now.  The code I sent should work
> fine.
> 
> It was just an oversight likely from how the packages were reorganized.
> 
> 
> 
> 
> 
> sergio_101 wrote
>> dang! is there any way to get that back into the framework?
>> 
>> On Fri Jan 16 2015 at 2:31:41 PM Paul DeBruicker &lt;
> 
>> pdebruic@
> 
>> &gt; wrote:
>> 
>>> JQAjax used to have callback:json: but it got lost in the Seaside 3.1
>>> reshuffle.  I think it does what you want.
>>> 
>>> 
>>> JQAjax>>callback: aBlock json: anObject
>>>        "Register aBlock as a secondary callback. anObject is a reference
>>> to a
>>> Javascript object on the client-side. anObject will be serialized to a
>>> JSON
>>> string, sent back to the server, deserialized from JSON to nested
>>> Smalltalk
>>> objects, and result passed into aBlock.
>>> 
>>>        Note: The serialization of Javascript objects to JSON requires a
>>> modern web
>>> browser with native JSON support or the JSJsonDeploymentLibrary to be
>>> loaded. Objects that recursively refer to themselves and objects that
>>> contain or objects that contain methods might not be serializable and
>>> cause
>>> the web browser to loop inifinitely or throw an exception."
>>> 
>>>        self
>>>                callback: [ :value | aBlock value: (JSJsonParser parse:
>>> value) ]
>>>                value: (JSJson new stringify: anObject)
>>> 
>>> 
>>> 
>>> 
>>> 
>>> sergio_101 wrote
>>>> i accidentally sent this to the pharo group, rather than this group..
>>> so
>>> i
>>>> hope they forgive me over there. anyway:
>>>> 
>>>> i am currently working on an app that uses a javascript library to
>>> render
>>>> the state of an object inside seaside. i am trying to figure out the
>>> best
>>>> way to transfer the state of object to javascript.
>>>> 
>>>> the state of the machine changes via form inputs and ajax.
>>>> 
>>>> i already have the code to convert the state of my object to json, so i
>>> am
>>>> thinking i can do this one of two ways..
>>>> 
>>>> via ajax, inject the json code into a variable in a function that is
>>> fired
>>>> off by ajax. i just am not sure how to inject this json string into the
>>>> page where it would look like the contents of a variable. any ideas?
>>>> 
>>>> or, i could make a component that just spits out the current state as a
>>>> json string. this way, when the value of a form element changes, that
>>>> value
>>>> is sent over ajax to seaside, and seaside can answer back with the new
>>>> state as a json string. i am just not sure how to implement this,
>>> either.
>>>> any ideas?
>>>> 
>>>> let me know if there is a better approach to this, also.
>>>> 
>>>> thanks!
>>>> 
>>>> _______________________________________________
>>>> seaside mailing list
>>> 
>>>> seaside at .squeakfoundation
>>> 
>>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>> 
>>> 
>>> 
>>> 
>>> 
>>> --
>>> View this message in context: http://forum.world.st/passing-
>>> json-between-seaside-and-javascript-tp4799930p4800031.html
>>> Sent from the Seaside General mailing list archive at Nabble.com.
>>> _______________________________________________
>>> seaside mailing list
>>> 
> 
>> seaside at .squeakfoundation
> 
>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>> 
>> 
>> _______________________________________________
>> seaside mailing list
> 
>> seaside at .squeakfoundation
> 
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> 
> 
> 
> 
> 
> --
> View this message in context: http://forum.world.st/passing-json-between-seaside-and-javascript-tp4799930p4800074.html
> Sent from the Seaside General mailing list archive at Nabble.com.
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



More information about the seaside mailing list