Skip to content

Instantly share code, notes, and snippets.

@unknownuser88
Created January 6, 2014 15:52
Show Gist options
  • Save unknownuser88/8284809 to your computer and use it in GitHub Desktop.
Save unknownuser88/8284809 to your computer and use it in GitHub Desktop.
Fix broken images using ajax
$(".productBoxImage img").each(function() {
var _this = $(this);
$.ajax({
url: $(this).attr('src'),
type: 'HEAD',
async: false,
error: function(e) {
if (e.status == '404') {
$(_this).attr('src', [replaceImageUrl]);
}
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment