I need to get the position of a div in real time, and I'm trying the following:
html div
id: 'square';
script: (html jQuery new draggable
onStop: (html jQuery ajax
callback: [Transcript show: html jQuery this position])).
Unfortunately it doesn't work, the transcript shows: 'a JQueryInstance ($(this).position())'
What's the proper way to do this?
Try this:
In your code, html jQuery this position will evaluate to a script-text that never gets to the client because it is not written to the document. Instead it gets written to the Transcript, whenever the callback is triggered. To get the script to the client, use the callback:json: method, that executes the script passed as argument to json:, transfers the result back to Seaside using ajax and then triggers the callback with the submitted value.