You can use the jQuery ajaxSuccess()
<http://api.jquery.com/ajaxSuccess/>method. It can register a handler to fire
whenever an Ajax call completes
successfully. If your page makes multiple different Ajax calls, you can
determine which one it is via the url in the Ajax settings object, which
gets passed to the ajaxSuccess() callback. Maybe something like (not
tested):
{{=LOAD('default', 'mycomponent.load', ajax=True, target='mycomponent')}}
<script>
jQuery(function() {
jQuery('#mycomponent').ajaxSuccess(function(e, xhr, settings) {
if (settings.url == '/default/mycomponent.load') {
jQuery(this).doSomething();
};
});
});
</script>
Anthony
On Thursday, June 28, 2012 3:53:14 PM UTC-4, monotasker wrote:
>
> I'd like to be able to bind a jquery function to a div that is the
> container for a web2py component, so that when the component content is
> updated by the controller the jquery function is triggered. But I'm not
> sure whether there is a stock event that would cover the component refresh
> (I don't know the internals of web2py_ajax.js). Does anyone have any
> suggestions?