Reputation: 2597
I'm loading some scripts dynamically as follows:
//fileA.js
$('body').on('LoginWidget', function() {
$.cachedScript('/js/min/AddressWidgets.min.js').done(function() {
extend(AddressBookWidget, ShippingAddressWidget);
console.log("throwing event")
$('body').trigger('ShippingAddressWidget loaded');
});
});
and then:
//fileB.js
$(document).ready(
function() {
console.log("catching event")
$('body').on('ShippingAddressWidget loaded', function() {
// do stuff
});
...
In the console, I see:
catching event
throwing event
But the event catcher is not triggered. jquery 2.1.2
Upvotes: 0
Views: 67