How to move an anonymous function out

Posted by cf_PhillipSenn on Stack Overflow See other posts from Stack Overflow or by cf_PhillipSenn
Published on 2010-06-11T17:49:28Z Indexed on 2010/06/11 17:52 UTC
Read the original article Hit count: 202

Filed under:

I have a $.ajax call with an error callback:

error: function(result){
$('#msg').text(result.statusText).addClass('err');
}

I'd like to change it to a more generic:

error: myError(result)

And then all by itself:

function myError(theError){
$('#msg').text(theError.statusText).addClass('err');
} 

But firebug is telling me "result" is not defined.

© Stack Overflow or respective owner

Related posts about jQuery