$(window).error(function(msg, url, line){ jQuery.post("error_log.php", { msg: msg, url: url, line: line });});