[buddypress-trac] [BuddyPress] #4500: Ajax loading doesn't refresh JS onload
buddypress-trac
noreply at wordpress.org
Tue Nov 12 06:18:39 UTC 2013
#4500: Ajax loading doesn't refresh JS onload
-------------------------+-----------------------------
Reporter: sgr33n | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: Theme | Version:
Severity: normal | Resolution:
Keywords: |
-------------------------+-----------------------------
Comment (by vhauri):
Unless BP turns off the fact that ajax in jQuery is global, you can
actually accomplish this hook without code modifications. If you hook your
method to the jQuery.ajaxComplete() function, you'll get access to the url
as a property of the third function param. This means you can check each
completed ajax request on the page, test the URL for a match, and if it
matches, run your ajax knowing that new content, etc. was just loaded via
ajax. You also get the XMLHttpRequest object as the second param, so you
can confirm success, etc. before firing your custom actions.
Check out more info here: http://api.jquery.com/ajaxComplete
/#ajaxComplete-handlerevent--XMLHttpRequest--ajaxOptions
That being said, what I just suggested above is all kinds of a hack, and
it would be awesome to replace that with published events.
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4500#comment:2>
BuddyPress <http://buddypress.org/>
BuddyPress
More information about the buddypress-trac
mailing list