Skip to main content

Bug Tracker

Side navigation

#11495 closed bug (invalid)

Opened March 21, 2012 09:42AM UTC

Closed March 21, 2012 11:51PM UTC

Last modified March 22, 2012 11:52AM UTC

.load() always calls the success handler

Reported by: eldmannen+jquery@gmail.com 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/

Attachments (0)
Change History (3)

Changed March 21, 2012 07:29PM UTC by fastfasterfastest comment:1

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.

Changed March 21, 2012 11:51PM UTC by sindresorhus comment:2

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/

Changed March 22, 2012 11:52AM UTC by anonymous comment:3

You are right, I am wrong.

Sorry for wasting your time, I should have payed more attention to the documentation.