I have the following function as a fallback when the URL of the image returns 404. The function should happen after the AJAX. So when AJAX is made, and the URL returns 404, the image will replace the broken image. This functions works in Safari and Firefox, but not in Chrome.
When it's not working in Chrome, the console says:
imageOnError is not defined.
function imageOnError(img) {
img.onerror = ' ';
img.src = "http://v.images.boldride.com/vorsteiner/2012/vorsteiner-bmw-m3-gts5.1471x972.Jul-11-2012_13.02.33.232886.jpg";
return true;
}
Any ideas what's going on with it?
Here is the JSFiddle