[Glass] How to ensure onSuccess: is sent

Bob Nemec bobn at rogers.com
Mon May 10 11:21:54 PDT 2021

I've posted this question on the PharoJS Seaside forum and on stackoverflow, asking about onSuccess: not working correctly after a callback. In a text input field, if the user presses the [Enter] key we run this code...

html jQuery ajax        callback: [:value | self doSearchWith: value] value: html jQuery this value;
        onSuccess: ((html jQuery id: 'fieldId') load html: [:h | ...div to be rendered after search... ])

The intermittent symptom is that the user enters a value, presses [Enter]. The entered value reverts back to the previous value and the search result does not change. At first I thought the problem was that the onSuccess: script was being sent before the callback, but, after reading the gem logs more carefully, the problem turns out to be that the onSuccess: script is not run at all. The only place I run multiple web servers is in our GS + HAProxy setup. There is never a problem with one gem or in VW.

If I add 'async: false' then the onSuccess: script always runs. But while the callback is running, the user sees no feedback. For most user actions I show a busy gif and a 10% opaque overlay. Neither of those work with 'async: false' because all display rendering held up. 
Any suggestions for how I can ensure a onSuccess: script runs after a callback? 
I understand that onSuccess: depends on the HTTP response code, but the callback action is always successful. 
Thanks for any help,Bob Nemec
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gemtalksystems.com/mailman/private/glass/attachments/20210510/b3a0252a/attachment.htm>

More information about the Glass mailing list