Send Email Notifications for Broken Images Using jQuery Ajax
David Walsh posted a priceless and overly useful post about Send Email Notifications for Broken Images Using MooTools Ajax but the only problem with that is that he used MooTools ;).
For those that want to do the same thing with jQuery here is the JavaScript code, please have a read at his post for the PHP code and any discussion his post sparks.
- $(document)
- .ready(function(){
- $('img').error(function(){
- $.post('ajax-image-error.php',{'image':this.src,'page':location.href});
- });
- });
Yeah, I know, there is so much less code then the MooTools example, why is that? Psstt… because jQuery is better ;).
Here is a live demo (an email is not sent, but the returned data is appended to the page.



1. Geoff Buesing