novactown
novactown

Reputation: 137

Jquery ajax and success event?

Simple question but I cannot find any online documentation for the jquery success event in ajax.

What qualifies as a successfull ajax request?

Does the ajax have to send a value back to the javascript?

And if the above answer is no, how does JQuery know it was a success?

Upvotes: 1

Views: 615

Answers (2)

Andy Ray
Andy Ray

Reputation: 32076

Success means the request is successful, eg the server does not return an error code status (400 - 500 range).

Upvotes: 1

drch
drch

Reputation: 3080

See source here: https://github.com/jquery/jquery/blob/master/src/ajax.js#L520

If the status code is 2xx or 304 (Not modified) then it is considered successful. The server doesn't have to respond with any content beyond the appropriate headers.

Upvotes: 3

Related Questions