[jQuery] Re: private listeners for global triggers

2010-01-14 Thread Thomas Danemar
You can trigger a custom event on any object with trigger(). On the global document object, for example: $(document).trigger("myUpdateEvent"); and listen to it like so: $(document).bind("myUpdateEvent", someFunction); Fiddling around with the global document object is a bit icky, though. Bette

[jQuery] Re: Basic AJAX Q: how to replace current with XHR-fetched page?

2008-10-03 Thread Thomas Danemar
The easiest way to fetch another page and insert it into the DOM is by using load(): $('body').load('page.htm'); injects the contents of page.htm into . You can also use selectors in the url if you only want to fetch parts of the page: $('body').load('page.html #someelement') injects only the