[Seaside] Basic question about AJAX and callbacks

Winfried Jacobs news at winfried-jacobs.de
Fri Jul 11 13:37:20 UTC 2014


(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' ]
                 ]



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.

However, you could register multiple secondary callbacks like #callback:value:
#callback:json: etc.  But in your case, a secondary
callback is unnecessary.



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
>

 


More information about the seaside mailing list