<div>
                    John,
                </div><div><br></div><div>there's no use in serializing an anchor. You can serialize a form in order to transport the values of the form to the server, but there's no other use for that (http://api.jquery.com/serialize/)</div><div>As for the order of javascript, the script that's created here performs a single Ajax request to the server (by calling #ajax), responding with a script that replaces the contents of two html nodes.&nbsp;</div><div><blockquote type="cite"><div>html anchor</div><div>&nbsp;&nbsp; callback: [ self setIndex: aValue ];</div><div>&nbsp;&nbsp; onClick: (html jQuery ajax</div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; serializeThis;</div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; script: [ :s |&nbsp;(s jquery: anId) html: [ :h | self renderStuffOn: h ].</div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; s &lt;&lt; (s jQuery: anId2) html: [ :h | self renderSomeOtherStuffOn: h ]&nbsp;]...</div></blockquote></div><div>I think there's some confusion as to when the different blocks are executed. The script block [:s | …. ] is executed in response to the ajax request. It immediately executes the two html blocks [:h | … ] and the result is part of the script that the script-block produces.</div><div><br></div><div>When you debug that using Chrome or Firebug, check the network panel for the traffic that's generated. You should only see one get request and the response of that request is javascript code like jQuery("#id1").html("yadayada"); jQuery("#id2").html("yagayaga");</div><div><br></div><div>Now in the Original example there were some #load calls, that generate extra ajax requests. These request could lead to load-order conflicts. But as Ryan already pointed out, they only make things more complicated in this context.</div><div><br></div><div>Kind Regards</div><div>Karsten</div><div><br></div><div><br></div><div>--&nbsp;<br><div>Karsten Kusche - Dipl. Inf. (FH) - karsten@heeg.de</div><div>Georg Heeg eK - Köthen</div><div>Handelsregister: Amtsgericht Dortmund A 12812&nbsp;</div><div><br></div></div>
                 
                <p style="color: #A0A0A8;">Am Mittwoch, 5. Juni 2013 um 13:21 schrieb John McKeon:</p>
                <blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
                    <span><div><div><div>Hi Dario,</div>
<div>I think the trouble is that when you have two or more ajax scripts to be run you are not guaranteed which will run first. If you use a callback and send serializeThis to the ajax object, it runs before any scripts:</div>

<div>&nbsp;</div>
<div>html anchor</div>
<div>&nbsp;&nbsp; callback: [ self setIndex: aValue ];</div>
<div>&nbsp;&nbsp; onClick: (html jQuery ajax</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; serializeThis;</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; script: [ :s |&nbsp;(s jquery: anId) html: [ :h | self renderStuffOn: h ].</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; s &lt;&lt; (s jQuery: anId2) html: [ :h | self renderSomeOtherStuffOn: h ]&nbsp;]...<br></div>
<div>Regards,</div>
<div>John<br></div>
<div>On Wed, Jun 5, 2013 at 4:40 AM, <span dir="ltr">&lt;<a href="mailto:dtrussardi@tiscali.it" target="_blank">dtrussardi@tiscali.it</a>&gt;</span> wrote:<br><blockquote type="cite"><div>
<div style="WORD-WRAP:break-word">
<div>Ciao,</div>
<div><br></div>
<div>i have &nbsp;a anchor based on this code:</div>
<div><span style="WHITE-SPACE:pre-wrap"></span></div>
<div><span style="WHITE-SPACE:pre-wrap"></span>html anchor</div>
<div><span style="WHITE-SPACE:pre-wrap"></span>script: (html jQuery this button</div>
<div><span style="WHITE-SPACE:pre-wrap"></span>text: true;</div>
<div><span style="WHITE-SPACE:pre-wrap"></span>primaryIcon: &nbsp;'ui-icon-circle-plus'</div>
<div><span style="WHITE-SPACE:pre-wrap"></span>title: 'Successivo');</div>
<div><br></div>
<div><span style="WHITE-SPACE:pre-wrap"></span>onClick: (html jQuery ajax</div>
<div><span style="WHITE-SPACE:pre-wrap"></span><span style="WHITE-SPACE:pre-wrap"></span>( html jQuery ajax&nbsp;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="WHITE-SPACE:pre-wrap"></span>script: [ :s | <span style="WHITE-SPACE:pre-wrap"></span>s &lt;&lt; (s jQuery: &nbsp;#'base') load html:[:h|<b> <span style="WHITE-SPACE:pre-wrap"></span>"A"<span style="WHITE-SPACE:pre-wrap"> </span>self incrementaIndex: true.</b>&nbsp;</div>

<div><span style="WHITE-SPACE:pre-wrap"></span>"B1"<span style="WHITE-SPACE:pre-wrap"> </span><span style="WHITE-SPACE:pre-wrap"></span>(self renderingBaseOn: &nbsp;h)].<span style="WHITE-SPACE:pre-wrap"> </span></div>

<div><br></div>
<div><span style="WHITE-SPACE:pre-wrap"></span><span style="WHITE-SPACE:pre-wrap"></span>s &lt;&lt; (s jQuery: #'orarioRiferimento') load html:[:h| <span style="WHITE-SPACE:pre-wrap"></span>&nbsp;"B2"<span style="WHITE-SPACE:pre-wrap"> </span>( self renderOrarioRiferimentoOn: h)]]);<span style="WHITE-SPACE:pre-wrap"> </span></div>

<div><span style="WHITE-SPACE:pre-wrap"></span>with: '&gt;'.</div>
<div><br></div>
<div><br></div>
<div>My objective when a user click on this anchor is:</div>
<div><br></div>
<div><span style="WHITE-SPACE:pre-wrap"></span>A)&nbsp;<span style="WHITE-SPACE:pre-wrap"> </span>&nbsp;update a index &nbsp;with the&nbsp;&nbsp;<span style="WHITE-SPACE:pre-wrap"> </span><b>self incrementaIndex: true.</b></div>
<div><br></div>
<div><span style="WHITE-SPACE:pre-wrap"></span>B1)&nbsp;<span style="WHITE-SPACE:pre-wrap"> </span>update the div #base with:<span style="WHITE-SPACE:pre-wrap"> </span>&nbsp;<span style="WHITE-SPACE:pre-wrap"> </span>&nbsp;self renderingBaseOn: h</div>

<div><br></div>
<div><span style="WHITE-SPACE:pre-wrap"></span>B2) update the div #orarioRiferimento&nbsp;<span style="WHITE-SPACE:pre-wrap"> </span>with:<span style="WHITE-SPACE:pre-wrap"> </span>&nbsp;self renderOrarioRiferimentoOn: h</div>
<div><br></div>
<div><br></div>
<div>Where the B1 - B2 &nbsp;rendering is based on the index state.</div>
<div><br></div>
<div>Now i have a&nbsp;strange behavior because sometime the B2<span style="WHITE-SPACE:pre-wrap"> </span>&nbsp;div #orarioRiferimento<span style="WHITE-SPACE:pre-wrap"> </span>&nbsp;renderings is not aligned to the index.</div>
<div><br></div>
<div>As if the onClick script action &nbsp;is not execute&nbsp;in the&nbsp;definition&nbsp;sequence.</div>
<div><br></div>
<div><br></div>
<div>Any suggestions ?</div>
<div><br></div>
<div>What is the right definition to solve this problematic type ?</div>
<div><br></div>
<div><span style="WHITE-SPACE:pre-wrap"></span>Thanks,</div>
<div><br></div>
<div><span style="WHITE-SPACE:pre-wrap"></span>Dario</div>
<div><br></div>
<div><br></div></div><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>
<br></div></blockquote></div><br><br clear="all"><br>-- <br><a href="http://jmck.seasidehosting.st/" target="_blank">jmck.seasidehosting.st</a>  
</div><div><div>_______________________________________________</div><div>seaside mailing list</div><div><a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a></div><div><a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a></div></div></div></span>
                 
                 
                 
                 
                </blockquote>
                 
                <div>
                    <br>
                </div>