I'd like to know when a Javascript error occurs, and I'd like to be sent an email when this happens. I'm not sure if or how jQuery can help here, but I have a feeling that it can. I can write the server side script to email the error, that's not a problem. But, I'm not sure how to capture the Javascript error message and send it to the script that emails the error. Here's something untested that I was thinking might be a good start. I'm wondering if anyone else has coded something like this and would give me some pointers.
<script type="text/javascript"> $(function() { window.onerror=emailError; }); function emailerror(){ $.get("/emailError.cfm", { errorMessage: notSureWhatVariabletoPassinHere }); } </script>