7.7.1.4 Ajax Events - Reference Documentation
Authors: Graeme Rocher, Peter Ledbrook, Marc Palmer, Jeff Brown, Luke Daley, Burt Beckwith, Lari Hotari
Version: 2.3.8
7.7.1.4 Ajax Events
Specific JavaScript can be called if certain events occur, all the events start with the "on" prefix and let you give feedback to the user where appropriate, or take other action:<g:remoteLink action="show" id="1" update="success" onLoading="showProgress()" onComplete="hideProgress()">Show Book 1</g:remoteLink>
onSuccess
- The JavaScript function to call if successfulonFailure
- The JavaScript function to call if the call failedon_ERROR_CODE
- The JavaScript function to call to handle specified error codes (eg on404="alert('not found!')")onUninitialized
- The JavaScript function to call the a Ajax engine failed to initialiseonLoading
- The JavaScript function to call when the remote function is loading the responseonLoaded
- The JavaScript function to call when the remote function is completed loading the responseonComplete
- The JavaScript function to call when the remote function is complete, including any updates
XMLHttpRequest
variable to obtain the request:<g:javascript> function fireMe(event) { alert("XmlHttpRequest = " + event) } } </g:javascript> <g:remoteLink action="example" update="success" onFailure="fireMe(XMLHttpRequest)">Ajax Link</g:remoteLink>