Here's my code. It tries to load Leaflet library. When I turn crossDomain
option to true
, the error callback is not fired. When I turn the option to false, the error callback is fired, but it can't download the js, because it's crossdomain.
Why so hard? Is there any solution to this? There's an image placeholder instead of a web map (to not load it initially and save page loading time), and when user activates the map, the js should be loaded. But if it fails, I want to show a normal error message and a retry button.
$.ajax({
url: 'http://code.leafletjs.com/leaflet-0.3.1/leaflet.js',
success: start_map,
error: show_map_error,
dataType: 'script',
crossDomain: true
});
update: I tried complete
callback, it doesn't work either.
update2: the same applies to crossdomain $.getScript(...).fail(...)
.