[Seaside] Re: Jquery Ajax confirm: callback problem

Paul DeBruicker pdebruic at gmail.com
Thu Jul 19 15:11:53 UTC 2012


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
>



More information about the seaside mailing list