[Seaside] Re: Jquery Ajax confirm: callback problem
Johan Brichau
johan at inceptive.be
Fri Jul 20 12:53:17 UTC 2012
I think you want to change as follows:
post -> ajax
jQuery this -> jQuery id: someId
load html: -> replaceWith:
& properly parenthesize such that: s << (...)
I'll try to remember posting a complete answer when I get back as well.
Johan (sent from my mobile)
On 20 Jul 2012, at 14:38, John McKeon <p3anoman at gmail.com> wrote:
> I would try moving the code from the callback: block into the load html: block but leave everything else the same as in the original code.
>
> On Fri, Jul 20, 2012 at 2:22 AM, Joachim Tuchel (objektfabrik) <jtuchel at objektfabrik.de> wrote:
>
>
> Paul,
>
> thanks for answering.
>
>
> Unfortunately, it doesn't work for me. It leaves me with a blank page on Chrome and a text-only page containing teh html of the complete page re-rendered. Even if I replace the jQuery this with the concrete ID of my list, it doesn't work.
>
>
>
> Wouldn't a POST request reload the whole page anyways?
>
>
>
> Joachim
>
>
>
> Paul DeBruicker <pdebruic at gmail.com> hat am 19. Juli 2012 um 17:11 geschrieben:
>
> > Hi Joachim,
> >
> > I do it like this:
> >
> > (html jQuery post
> > confirm: 'Do you really want to delete this object?';
> > script: [ :s |
> > self deleteObject: obj.
> > s << s jQuery this load html: [:t | self renderListOn: t] ]);
> >
> >
> > The #script: is a script rendering callback that only gets run if the
> > confirm is confirmed (accepted?). You might have to change the send of
> > #this to the specific #id you mean to load into.
> >
> > But I'm not sure if its the best way. And would love to learn how to
> > make it better/safer if there are obvious errors.
> >
> >
> >
> > Good luck
> >
> > Paul
> >
> >
> >
> >
> >
> >
> >
> > On 07/19/2012 05:21 AM, jtuchel wrote:
> > > Funnily, the code Seaside generates looks as if it does what I want:
> > >
> > > if(confirm("Do you really want to delete this object?"))
> > > {
> > > $.ajax({
> > > "url":"/MyApp",
> > >
> > > "data":["_s=XON7moFvT7ejEWMY","_k=OBzPflVTFHdzvNyy","20"].join("&"),
> > > "complete":function(){
> > >
> > > $(this).load("/MyApp",["_s=XON7moFvT7ejEWMY","_k=OBzPflVTFHdzvNyy","21"].join("&"))
> > > }
> > > })
> > > }
> > >
> > > I read this as if user clicks OK, call the ajax callback which deletes on
> > > the server side, and when that is complete, load the contents of the list
> > > again and have it rendered by the server.
> > >
> > > So maybe I am not really hunting for the complete event, but what else?
> > > Or is it so that the ajax call to a server side callback does not wait for
> > > the server side to finish? Does Seaside return an HTTP response immediately?
> > > If so, what tricks are there to wait for the server to finish deleting and
> > > redraw after that?
> > >
> > > Thanks for reading
> > >
> > > Joachim
> > >
> > > --
> > > View this message in context: http://forum.world.st/Jquery-Ajax-confirm-callback-problem-tp4640695p4640697.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
> > >
> >
> > _______________________________________________
> > 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20120720/864b4344/attachment.htm
More information about the seaside
mailing list