[Seaside] Dumb Question: How to render new state after ajax callbacks?

Julian Fitzell jfitzell at gmail.com
Thu Nov 5 01:00:15 UTC 2009


You could use #refresh on either SUScript or JSScript (depending on
the version of Seaside) to cause a refresh of the page.

For example (in 3.0a5):

html submitButton
	onClick: (html jQuery ajax script: [ :s | s refresh ]);
	with: 'Refresh the page'.

So you could swap out a component with the following code, though I'm
not sure why you'd want to do it this way... (I guess it allows the
refresh to be optional depending on whether you actually end up doing
a #show: or not?)

html submitButton
	onClick: (html jQuery ajax
		script: [ :s | self show: WACounter new. s refresh ]);
	with: 'Show a counter'.

Julian

On Wed, Nov 4, 2009 at 3:28 PM, Richard Durr
<richard.durr at googlemail.com> wrote:
> Thanks for all the answers. Is it possible to get a refresh-url through
> javascript?
>
> On Wed, Nov 4, 2009 at 11:12 PM, Julian Fitzell <jfitzell at gmail.com> wrote:
>>
>> And to be clear, if you really want, you should be able to use #show:
>> within an ajax callback, just not #call:. You should also be able to
>> use #answer: as long as the component was displayed with #show: and
>> not #call:. But of course, you'll still have to reload the page if you
>> want to see the result.
>>
>> Doing a call in an ajax callback makes little sense because it would
>> abort the callback without you being able to generate a response
>> (normal callbacks redirect to another URL which generates the HTML
>> output).
>>
>> Julian
>>
>> On Wed, Nov 4, 2009 at 1:30 PM, Boris Popov <boris at deepcovelabs.com>
>> wrote:
>> > If your ajax callback will be forcing a full refresh, aren't you better
>> > off
>> > just doing a regular callback?
>> >
>> > -Boris (via BlackBerry)
>> > ________________________________
>> > From: seaside-bounces at lists.squeakfoundation.org
>> > <seaside-bounces at lists.squeakfoundation.org>
>> > To: Seaside - general discussion <seaside at lists.squeakfoundation.org>
>> > Sent: Wed Nov 04 13:16:51 2009
>> > Subject: Re: [Seaside] Dumb Question: How to render new state after ajax
>> > callbacks?
>> >
>> >
>> > 2009/10/15 Karsten <karsten at heeg.de>
>> >>
>> >> Hi Richard,
>> >>
>> >> you can't do that with Ajax easily. The problem is that during an AJAX
>> >> callback you're actually rendering and not in the normal callback
>> >> phase.
>> >> You could however register a callback that does the answer and send
>> >> Javascript back to the browser to make the browser jump to the
>> >> callback's
>> >> url. However, that's a bit tricky :-)
>> >
>> >
>> > Hi.
>> >
>> > Why It can not be implemented in simplest, user transparent way as
>> > Richard
>> > wrote? Or it can?
>> > I think it's really usefull stuff.
>> >
>> > _______________________________________________
>> > seaside mailing list
>> > seaside at lists.squeakfoundation.org
>> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>> >
>> >
>> _______________________________________________
>> seaside mailing list
>> seaside at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>


More information about the seaside mailing list