#1616 closed enhancement (worksforme)
Defining Custom javascript events for Ajax based loading of activity etc
Reported by: | sbrajesh | Owned by: | |
---|---|---|---|
Milestone: | 1.2 | Priority: | major |
Severity: | Version: | ||
Component: | Keywords: | ||
Cc: | sbrajesh, jeff@… |
Description (last modified by )
As of bp 1.2, activity stream is loaded using ajax so are some other components. So what If I want to call one of my javascript method after the activity is loaded. How do I get the idea when the activity is loaded(Just an example).
Would not it be better to define custom events and fire them when some content is loaded(say activity_loaded) ,other developers can hook their custom code to these events. YUI provides an easy way to define custom events but there can be other implementations too.
What are other developers are thinking about it? How do you know from you javascript code when activity is loaded or not.
I will request to please add custom events on the completion of the actions, like after calling "bp_activity_request","bp_filter_request". That would help the third party plugin developers tremendously.
Thought please.
Change History (9)
#3
@
15 years ago
hi Jeff
I have just updated to r2323 and I still don't see the solutions. The problem is not how to call your method, the problem is how do we know when to call the our spcific javascript methods which we want to call after content is loaded, ondomready will not help in this case.
#5
@
15 years ago
- Resolution set to worksforme
- Status changed from new to closed
Take a look at "Global Events" on this page: http://docs.jquery.com/Ajax_Events
You should be able to hook into the "ajaxComplete" event.
#6
follow-up:
↓ 8
@
15 years ago
- Description modified (diff)
Actually "ajaxStop" may be the event you are looking for.
#8
in reply to:
↑ 6
@
15 years ago
Replying to apeatling:
Actually "ajaxStop" may be the event you are looking for.
Thanks Andy.yes, ajaxStop can be a workaround, but in case of your own plugin doing ajax requests, It may cause trouble as it is a global event.
I will experiment more and will let you know again.
Does r2322 help?