Showing and hiding an overlay during an ajax call

Dave <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.squeak.seaside
Message-ID <[email protected]>
Hi guys,

I want to show and dismiss an overlay
(https://gasparesganga.com/labs/jquery-loading-overlay/) during an quite
long processing that starts from an ajax call.
Showing the overlay is not an issue, but I can't dismiss it.


My code is:


html document addLoadScript: (JSStream on: '$.LoadingOverlay("show");').

html jQuery ajax
		callback: [ ... ] value: (JSStream on: '...');
		onSuccess:
			((html jQuery id: 'myId') load
				html: [ :h | self veryLongOperationOn: h ]).
				
				
Now I don't know where to put the code to hide the overlay. If I write:

html jQuery ajax
		callback: [ ... ] value: (JSStream on: '...');
		onSuccess:
			((html jQuery id: 'myId') load
				html: [ :h | self veryLongOperationOn: h ]);
		*onComplete: (html document addLoadScript: (JSStream on:
'$.LoadingOverlay("hide");'))*
		
The overlay immediately disappears because the onComplete does not wait for
the veryLongOperation. So I think I should put the code in the block like:

html jQuery ajax
		callback: [ ... ] value: (JSStream on: '...');
		onSuccess:
			((html jQuery id: 'myId') load
				html: [ :h | self veryLongOperationOn: h.				
				*h document addLoadScript: (JSStream on: '$.LoadingOverlay("hide");')*
])

but of course it does not work.

Can you help me please?
TIA
Dave



--
View this message in context: http://forum.world.st/Showing-and-hiding-an-overlay-during-an-ajax-call-tp4954136.html
Sent from the Seaside General mailing list archive at Nabble.com.
_______________________________________________
seaside mailing list
[email protected]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.