[Seaside] Basic question about AJAX and callbacks

Mariano Martinez Peck marianopeck at gmail.com
Fri Jul 11 14:10:29 UTC 2014


On Fri, Jul 11, 2014 at 10:37 AM, Winfried Jacobs <news at winfried-jacobs.de>
wrote:

> (sorry if this message comes up multiple times)
>
> Hello Mariano,
>
> JQAjax>>script: ist a callback, so you don't need both #callback: and
> #script: .
> Instead, you should merge both of your callback blocks into one:
>
>      html jQuery ajax
>          serializeChildren: (html jQuery: '#myFormID');
>          script: [ :s |
>                  "code from your first #callback: goes in here."
>                  "..."
>
>                  self halt. s << (s jQuery id: ('tr1')) replaceWith:[:r | r
> html: 'mariano' ]
>                  ]
>
>
>
Hi Winfried,

You know...yesterday night, just before going to sleep, I realized that
indeed, I could put by "callback code" inside the very same #script: and
then from there re-render (replaceWith...) from there.


>
> One possible reason why your code doesn't work: #callback: and #script: are
> primary callbacks, but you can only register one primary callback for an
> ajax
> object.
>
>
OK, I see.


> However, you could register multiple secondary callbacks like
> #callback:value:
> #callback:json: etc.  But in your case, a secondary
> callback is unnecessary.
>
>
OK, thanks for the explanation. I will read the web 2.0 chapter of the
Dynamic Web Development..otherwise...why did I buy it? hahaha.

Thanks,


>
>
> Cheers
> Winfried
>
>
>
> > Mariano Martinez Peck <marianopeck at gmail.com> hat am 11. Juli 2014 um
> 04:23
> > geschrieben:
> >
> >  Well...not there yet...now I am able to render the new table row with
> all the
> >'mariano'. And the row itself seems to reflect changes (the callback of
> the
> >ajax is really executed). The problem now is that I don't know how to
> make my
> >render script to happen AFTER the callback of the ajax. I tried #script:
> ,
> >#onComplete: and #onSuccess:  (just in case). What I need is to make the
> ajax
> >call, serialize the form, execute the ajax callback, and then do the
> replace of
> >the tr (with a script).
> >
> >  The only one that seems to be executed later is #script: but when I do
> this,
> >the callback of the ajax is not executed.
> >
> >  Any ideas?
> >
> >  Thanks,
> >
> >
> >  On Thu, Jul 10, 2014 at 6:22 PM, Mariano Martinez Peck <
> marianopeck at gmail.com
> ><mailto:marianopeck at gmail.com> > wrote:
> >    > >    ouuuuch
> > >
> > >    sorrryyyy by bad hahahhaha. Very funny. I will explain later. Don't
> loose
> > >your time.
> > >
> > >    Best,
> > >
> > >
> > >
> > >    On Thu, Jul 10, 2014 at 6:00 PM, Esteban A. Maringolo
> > ><emaringolo at gmail.com <mailto:emaringolo at gmail.com> > wrote:
> > >      > > > Maybe you should use #onComplete: instead of #script: in
> your
> > >JQAjax object.
> > > >      _______________________________________________
> > > >      seaside mailing list
> > > >      seaside at lists.squeakfoundation.org
> > > ><mailto:seaside at lists.squeakfoundation.org>
> > > >
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> > > >    > >
> > >
> > >
> > >    --
> > >    Mariano
> > >    http://marianopeck.wordpress.com
> > >  >
> >
> >
> >  --
> >  Mariano
> >  http://marianopeck.wordpress.com
> >  _______________________________________________
> >  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
>



-- 
Mariano
http://marianopeck.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20140711/1345694a/attachment.htm


More information about the seaside mailing list