
Untitled
By: a guest on
Jun 12th, 2012 | syntax:
None | size: 0.81 KB | hits: 13 | expires: Never
Firefox doesn't show javascript errors on AJAX 'threads'?
$.ajax({
type: 'POST',
...
success: function(data) {
test_fn();
}
});
function test_fn() {
blah
}
$.ajax({
type: 'POST',
...
success: function(data) {
test_fn();
},
error: function(jqXHR, textStatus, errorThrown){
// Aw Snap... Check textStatus maybe?
}
});
function wrap(func) {
return function wrapped() {
try {
func.apply(this, arguments);
}catch(ex) {
if(console&&console.error) {
console.error(ex);
}else{
alert(ex);
}
}
};
}
$.ajax({
...
success: wrap(function(data) {
// Test it by generating an error by calling a number.
(1)();
})
});