<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 29, 2014 at 11:16 PM, Paul DeBruicker <span dir="ltr">&lt;<a href="mailto:pdebruic@gmail.com" target="_blank">pdebruic@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Don&#39;t know for sure.  Do you send #onAjaxStart: anyplace else?<br>
<br>
<br>
Just for another example - the way I do it is in the footer of my app:<br>
<br>
renderAddLoadScripts: html<br>
        html document<br>
                addLoadScript:<br>
                        (html jQuery document<br>
                                onAjaxStart: (html jQuery class: #spinner) show;<br>
                                onAjaxStop: (html jQuery class: #spinner) hide;<br>
                                onAjaxError: (self ajaxErrorHandler asFunction: #(&#39;event&#39; &#39;jqxhr&#39;<br>
&#39;settings&#39; &#39;exception&#39;)))<br>
<br>
<br></blockquote><div><br></div><div>Interesting. Could you share the #ajaxErrorHandler? </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
<br>
<br>
<br>
Mariano Martinez Peck wrote<br>
&gt; On Wed, Oct 29, 2014 at 10:39 PM, Esteban A. Maringolo &amp;lt;<br>
<br>
&gt; emaringolo@<br>
<div><div class="h5"><br>
&gt; &amp;gt; wrote:<br>
&gt;<br>
&gt;&gt; I don&#39;t know for autocomplete, but a long time ago I implemented that<br>
&gt;&gt; like<br>
&gt;&gt; this:<br>
&gt;&gt;<br>
&gt;&gt; html document addLoadScript: (JSStream on:<br>
&gt;&gt; &#39;$(document).ajaxComplete(function() {$(&quot;#xhrstatus&quot;).hide();})&#39;).<br>
&gt;&gt; html document addLoadScript: (JSStream on:<br>
&gt;&gt; &#39;$(document).ajaxStart(function() {$(&quot;#xhrstatus&quot;).show();})&#39;).<br>
&gt;&gt;<br>
&gt;&gt; And it works well. I could refactor it, but because it works...<br>
&gt;&gt;<br>
&gt;<br>
&gt; WTF! that worked!! Thanks Esteban! This works for me:<br>
&gt;<br>
&gt; renderAjaxLoadingDivOn: html<br>
&gt; html<br>
&gt; div<br>
&gt; style: &#39;display:none&#39;;<br>
&gt; id: &#39;loading&#39;;<br>
&gt; class: &#39;loading&#39;;<br>
&gt; with: &#39;Loading...&#39;.<br>
&gt; html document addLoadScript: (JSStream on:<br>
&gt; &#39;$(document).ajaxComplete(function() {$(&quot;#loading&quot;).hide();})&#39;).<br>
&gt; html document addLoadScript: (JSStream on:<br>
&gt; &#39;$(document).ajaxStart(function() {$(&quot;#loading&quot;).show();})&#39;).<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; does anyone know what is the difference or why this one works while the<br>
&gt; other does not?<br>
&gt;<br>
&gt; Thanks Esteban.<br>
&gt;<br>
&gt;<br>
&gt; Esteban A. Maringolo<br>
&gt;&gt;<br>
&gt;&gt;<br>
</div></div>&gt;&gt; 2014-10-29 22:35 GMT-03:00 Mariano Martinez Peck &amp;lt;<br>
<br>
&gt; marianopeck@<br>
<br>
&gt; &amp;gt;:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; On Wed, Oct 29, 2014 at 8:24 PM, Paul DeBruicker &amp;lt;<br>
<br>
&gt; pdebruic@<br>
<br>
&gt; &amp;gt;<br>
<div><div class="h5">&gt;&gt; wrote:<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; What jQuery version?<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; It might be because the #onAjaxStart: and #onAjaxStop: methods should<br>
&gt;&gt; only<br>
&gt;&gt; &gt;&gt; be set on the document for some jQuerys (e.g. &gt;= version 1.8) see:<br>
&gt;&gt; &gt;&gt; <a href="http://api.jquery.com/ajaxStart/" target="_blank">http://api.jquery.com/ajaxStart/</a><br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Thanks Paul. I am using 1.11.0. So if I understand what you mean, I<br>
&gt;&gt; guess I<br>
&gt;&gt; &gt; should do instead:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; html<br>
&gt;&gt; &gt; div<br>
&gt;&gt; &gt; style: &#39;display:none&#39;;<br>
&gt;&gt; &gt; class: &#39;quuveLoading&#39;;<br>
&gt;&gt; &gt; script: (html jQuery document<br>
&gt;&gt; &gt; onAjaxStart: (html jQuery this show);<br>
&gt;&gt; &gt; onAjaxStop: (html jQuery this hide));<br>
&gt;&gt; &gt; with: &#39;Loading...&#39;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; right? still not working thought :(<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; I tried even a simple &#39;alert(&#39;&#39;aa&#39;&#39;);&#39; but still not getting called..<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Thanks anyway.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Mariano Martinez Peck wrote<br>
&gt;&gt; &gt;&gt; &gt; Hi guys,<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; My app has a some code (thanks Esteban Lorenzano for sharing it with<br>
&gt;&gt; me)<br>
&gt;&gt; &gt;&gt; &gt; to<br>
&gt;&gt; &gt;&gt; &gt; show a little &quot;Loading...&quot; banner... That is:<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; renderAjaxLoadingDivOn: html<br>
&gt;&gt; &gt;&gt; &gt; html<br>
&gt;&gt; &gt;&gt; &gt; div<br>
&gt;&gt; &gt;&gt; &gt; style: &#39;display:none&#39;;<br>
&gt;&gt; &gt;&gt; &gt; class: &#39;loading&#39;;<br>
&gt;&gt; &gt;&gt; &gt; script: (html jQuery this<br>
&gt;&gt; &gt;&gt; &gt; onAjaxStart: (html jQuery this show);<br>
&gt;&gt; &gt;&gt; &gt; onAjaxStop: (html jQuery this hide));<br>
&gt;&gt; &gt;&gt; &gt; with: &#39;Loading...&#39;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Now...it works well for some explicit parts where I use ajax.<br>
&gt;&gt; However,<br>
&gt;&gt; &gt;&gt; &gt; it<br>
&gt;&gt; &gt;&gt; &gt; doesn&#39;t work for the JQAutocomplete. It my case, the callback to the<br>
&gt;&gt; &gt;&gt; &gt; autocomplete can take some seconds. It seems #onAjaxStart: is NOT<br>
&gt;&gt; &gt;&gt; &gt; intercepting what the autocomplete os doing. Could it be because<br>
&gt;&gt; &gt;&gt; &gt; autocomplete is doing a getJson actually?<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; The key code of the autocomplete is:<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; search: aSearchBlock labels: aLabelsBlock callback: aCallbackBlock<br>
&gt;&gt; &gt;&gt; &gt; &quot;A one argument block aSearchBlock that will be evaluated with the<br>
&gt;&gt; term<br>
&gt;&gt; &gt;&gt; &gt; the<br>
&gt;&gt; &gt;&gt; &gt; user currently typed. The block is expected to answer a collection<br>
&gt;&gt; of<br>
&gt;&gt; &gt;&gt; &gt; objects. aLabelsBlock should answer a string label to be displayed<br>
&gt;&gt; for<br>
&gt;&gt; &gt;&gt; &gt; each<br>
&gt;&gt; &gt;&gt; &gt; object. aCallbackBlock is evaluated with the selected object and an<br>
&gt;&gt; ajax<br>
&gt;&gt; &gt;&gt; &gt; script to be performed.&quot;<br>
&gt;&gt; &gt;&gt; &gt;  | term mapping |<br>
&gt;&gt; &gt;&gt; &gt; mapping := IdentityDictionary new.<br>
&gt;&gt; &gt;&gt; &gt; &quot;assigments to temps don&#39;t work in GS 2.4&#39;<br>
&gt;&gt; &gt;&gt; &gt; <a href="http://code.google.com/p/glassdb/issues/detail?id=221" target="_blank">http://code.google.com/p/glassdb/issues/detail?id=221</a>&quot;<br>
&gt;&gt; &gt;&gt; &gt; term := WAValueHolder new.<br>
&gt;&gt; &gt;&gt; &gt; self source: ((self jQuery getJson<br>
&gt;&gt; &gt;&gt; &gt; callback: [ :value | term contents: value ]<br>
&gt;&gt; &gt;&gt; &gt; value: (JSStream on: &#39;request.term&#39;);<br>
&gt;&gt; &gt;&gt; &gt; text: [ :stream |<br>
&gt;&gt; &gt;&gt; &gt; stream json: ((aSearchBlock value: term contents) asArray collect: [<br>
&gt;&gt; &gt;&gt; &gt; :object |<br>
&gt;&gt; &gt;&gt; &gt; GRSmallDictionary new<br>
&gt;&gt; &gt;&gt; &gt; at: &#39;label&#39; put: (aLabelsBlock value: object);<br>
&gt;&gt; &gt;&gt; &gt; at: &#39;index&#39; put: (mapping at: object ifAbsentPut: [ mapping size + 1<br>
&gt;&gt; ]);<br>
&gt;&gt; &gt;&gt; &gt; yourself ]) ];<br>
&gt;&gt; &gt;&gt; &gt; onSuccess: &#39;response(arguments[0])&#39;;<br>
&gt;&gt; &gt;&gt; &gt; dataType: &#39;jsonp&#39;) asFunction: #(&#39;request&#39; &#39;response&#39;)).<br>
&gt;&gt; &gt;&gt; &gt; self onSelect: ((self jQuery ajax<br>
&gt;&gt; &gt;&gt; &gt; callback: [ :value | term contents: value greaseInteger ]<br>
&gt;&gt; &gt;&gt; &gt; value: (JSStream on: &#39;ui.item.index&#39;);<br>
&gt;&gt; &gt;&gt; &gt; script: [ :script |<br>
&gt;&gt; &gt;&gt; &gt; mapping keysAndValuesDo: [ :object :value |<br>
&gt;&gt; &gt;&gt; &gt; value = term contents<br>
&gt;&gt; &gt;&gt; &gt; ifTrue: [ aCallbackBlock value: object value: script ] ] ])<br>
&gt;&gt; &gt;&gt; &gt; asFunction: #(&#39;event&#39; &#39;ui&#39;))<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Any help would be very appreciated.<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Thanks,<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; --<br>
&gt;&gt; &gt;&gt; &gt; Mariano<br>
&gt;&gt; &gt;&gt; &gt; <a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; _______________________________________________<br>
&gt;&gt; &gt;&gt; &gt; seaside mailing list<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt; seaside@.squeakfoundation<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt; <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; --<br>
&gt;&gt; &gt;&gt; View this message in context:<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; <a href="http://forum.world.st/JQAutocomplete-and-onAjaxStart-tp4787505p4787543.html" target="_blank">http://forum.world.st/JQAutocomplete-and-onAjaxStart-tp4787505p4787543.html</a><br>
&gt;&gt; &gt;&gt; Sent from the Seaside General mailing list archive at Nabble.com.<br>
&gt;&gt; &gt;&gt; _______________________________________________<br>
&gt;&gt; &gt;&gt; seaside mailing list<br>
&gt;&gt; &gt;&gt;<br>
<br>
</div></div>&gt; seaside@.squeakfoundation<br>
<span class=""><br>
&gt;&gt; &gt;&gt; <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; --<br>
&gt;&gt; &gt; Mariano<br>
&gt;&gt; &gt; <a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; _______________________________________________<br>
&gt;&gt; &gt; seaside mailing list<br>
&gt;&gt; &gt;<br>
<br>
</span>&gt; seaside@.squeakfoundation<br>
<span class=""><br>
&gt;&gt; &gt; <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; seaside mailing list<br>
&gt;&gt;<br>
<br>
</span>&gt; seaside@.squeakfoundation<br>
<span class=""><br>
&gt;&gt; <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Mariano<br>
&gt; <a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; seaside mailing list<br>
<br>
</span>&gt; seaside@.squeakfoundation<br>
<br>
&gt; <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>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://forum.world.st/JQAutocomplete-and-onAjaxStart-tp4787505p4787555.html" target="_blank">http://forum.world.st/JQAutocomplete-and-onAjaxStart-tp4787505p4787555.html</a><br>
<div class=""><div class="h5">Sent from the Seaside General mailing list archive at Nabble.com.<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>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Mariano<br><a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br>
</div></div>