[Seaside] wait for callback and use results of return value

Sabine Manaa manaa.sabine at gmail.com
Thu Nov 22 12:19:07 UTC 2018


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


More information about the seaside mailing list