Bug Tracker

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#11495 closed bug (invalid)

.load() always calls the success handler

Reported by: [email protected] Owned by:
Priority: low Milestone: None
Component: ajax Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:

Description

The success handler function always get called, even if the server returns 404 Not Found or 500 Internal Server Error.

http://jsfiddle.net/c5pYV/

Change History (3)

comment:1 Changed 11 years ago by fastfasterfastest

The "success handler" is not a success handler, it is a complete callback - a function that gets called when the request has completed. See http://api.jquery.com/load/ and the 2nd example.

comment:2 Changed 11 years ago by sindresorhus

Component: unfiledajax
Priority: undecidedlow
Resolution: invalid
Status: newclosed

@fastfasterfastest is right. You can check against the textStatus argument to see if the load was successful.

Example: http://jsfiddle.net/mofle/c5pYV/1/

comment:3 Changed 11 years ago by anonymous

You are right, I am wrong. Sorry for wasting your time, I should have payed more attention to the documentation.

Note: See TracTickets for help on using tickets.