Re: [Pharo-users] Seaside JQuery Ajax processing question
Hi Ken, Doing this lookup serverside only works if the latency is low, i.e. not for a mobile site or one at the other side of the ocean. Only getting a hovertext can be done easier using the title attribute. You can find some code showing how to use jQuery in Deltawerken and Storyboard (on ss3.gemtalksystems.com). Stephan Verstuurd vanaf mijn iPhone
Can anyone help with a Seaside jQuery ajax issue?
I want to change the contents of a div when the mouse goes over a document element by means of an ajax call.
In this example, I have rendered a list of words as spans (one span per word). When the mouse goes over any span, I want to show the dictionary definition of the word in another div on the page. The dictionary definition has to be generated on the server side.
So I have to reference the current span ("this") in my ajax processing.
I find I can change the page contents as desired when the mouse moves over a span (see below) but I am completely clueless how to get the text of the span, the word itself, into the html I want to render.
renderContentOn: html |aQuery anAjax| aQuery := html jQuery expression:'span'. anAjax := html jQuery ajax. anAjax script: [ :s | s << ( (s jQuery: #GlossViewer) html:'This was written by an ajax call')]. aQuery onMouseEnter: anAjax asFunction.
html div id:#TextViewer; class:'TextPane'; with:[self renderWordsAsSpans: html]. html div id:#GlossViewer; class:'GlossPane'; with:'The grammatical analysis goes here'.
html document addLoadScript: aQuery.
My basic problem is that I have no real idea of how data is passed back to my program in an ajax call and how I can reference it in my code. The seaside documentation is not bad on JQuery as a whole, but explanations and examples of ajax processing with Jquery and Seaside are not easily found.
Stephan - Thanks. Latency is not an issue and besides I'm as interested in the principle as I am in this example. I obviously need to do more research. Thanks for the pointers. Ken -- View this message in context: http://forum.world.st/Seaside-JQuery-Ajax-processing-question-tp4704949p4704... Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
participants (2)
-
kmo -
Stephan Eggermont