Re: wait for callback and use results of return value

Sabine Manaa <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.squeak.seaside
Message-ID <[email protected]>
Yesterday I was asking this question and also asked in discord. 
In discord I wrote today with Johan Brichau. 
He gave the solution to me and I want to share it here because when I have a
problem, I often look here. 
The solution was like this (I remove the script brackets for the mailing
list). 

Thanks a lot, Johan!

The task is to call a javascript method and return a result from somewhere
in the javascript.
Clicking on the button opens an inspector in the smalltalk image.

renderTestOn: html
	html
		html:
			'script		
function getS3Data(callback) {
 	callback(''this goes back to the smalltalk image'' );	 
} 
/script		
'.
	html button
		onClick:
			((html javascript alias: 'getS3Data')
				apply:
					{((html jQuery ajax callback: [ :var | var inspect ] value: (html
javascript alias: 'value')) asFunction: #(value))});
		with: 'tedt'



--
Sent from: http://forum.world.st/Seaside-General-f86180.html
_______________________________________________
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.