Cool, thank you for the explanation! :)<div>That helped a lot, especially the last part about using #script: and about using #closest: . I couldn't figure it out for myself since I'm sometimes too insecure what methods to use when and what their semantic is, sigh.<div>
<div><br></div><div>Is something like the following actually possible at all?</div><div><br></div><div>html div onClick: (html jQuery this attributeAt: 'title' put: (html jQuery ajax loadValue: [ :s | s nextPutAll: #{test -> 1}]))</div>
<div><br></div><div>I've seen JQAjax>>#callback:json: but I can't wrap my head around how this works.<br>><</div><div><br></div><div><br><div class="gmail_quote">On Tue, Oct 6, 2009 at 2:31 PM, Lukas Renggli <span dir="ltr"><<a href="mailto:renggli@gmail.com">renggli@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">2009/10/6 Richard Durr <<a href="mailto:richard.durr@googlemail.com">richard.durr@googlemail.com</a>>:<br>
<div class="im">> Hello,<br>
> I'd like to set the background-color of a parent element that contains a<br>
> selectbox using ajax without replacing the whole. I tried to load the value<br>
> through "ajax html:" like so:<br>
> html select<br>
> onChange: (html jQuery ajax serialize: html jQuery this) ,<br>
> ((html jQuery this parent: '.model' ) cssAt: 'background-color' put:<br>
> (html jQuery ajax html: [:r | r text: 'red' ]));<br>
> callback: [ :value | aModelObject color: value key. ];<br>
> selected: selectedColor;<br>
> addAll: colors;<br>
> labels: [:item | item value.].<br>
<br>
</div>The use of<br>
<div class="im"><br>
html jQuery this parent: '.model'<br>
<br>
</div>is a bit strange, because this only returns the *direct* parents that<br>
have the class .model. You might easily end up with an empty result<br>
set and simply nothing happens. It might not be a problem in your<br>
case, but it would be more intention revealing if you used #closest:<br>
instead of #parent:<br>
<br>
The expression<br>
<div class="im"><br>
html jQuery ajax html: [:r | r text: 'red' ]<br>
<br>
</div>does not return the requested value, but the AJAX object itself.<br>
Furthermore AJAX calls are asynchronous, so they immediately return.<br>
<br>
Something along the following lines should work:<br>
<br>
(html jQuery this closest: '.model') cssAt: 'background-color' put: 'red'<br>
<br>
If you want to go through a server round-trip you could integrate the<br>
change into the AJAX call you do to serialize the value. What about<br>
something along ...<br>
<br>
html jQuery ajax<br>
serialize: html jQuery this;<br>
script: [ :script | script add: ((script jQuery: '.model')<br>
cssAt: 'background-color' put: currentColor) ]<br>
<br>
Cheers,<br>
Lukas<br>
<font color="#888888"><br>
--<br>
Lukas Renggli<br>
<a href="http://www.lukas-renggli.ch" target="_blank">http://www.lukas-renggli.ch</a><br>
_______________________________________________<br>
seaside mailing list<br>
<a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
</font></blockquote></div><br></div></div></div>