Using jQuery 1.4.4 This simple method doesn't work for some reason

$.get($(this).attr('rel'), function(response){}, 'script')
.error(function(){ alert('this failed')});

      

I get it. .error is not a method

... But it was added in version 1.4.3

http://api.jquery.com/error/

Is there some type that I have?

+3


source to share


1 answer


The return value $.get

in jQuery 1.4.3 has no method .error

. I'm not really sure what the return value is, but you should be able to test it. Whatever it is, he doesn't .error

. You will have to tie it to something else.

At some point, jQuery has started to return objects from jqxhr $.get

, $.post

, $.ajax

etc. I believe this is after 1.5 when they submitted Deferred

, but I'm not 100% sure. The jqxhr object has .done

, .fail

and .always

(implementation Deferred

), so you might do $.get().fail()

at some point after jQuery 1.5. You definitely can in jQuery 1.7.



Either update jQuery or use $.ajax

instead error

as a parameter.

+4


source







All Articles