Created
February 21, 2011 17:58
-
-
Save johnhunter/837428 to your computer and use it in GitHub Desktop.
Test case for a possible bug with JQuery 1.5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>ajax-error</title> | |
</head> | |
<body> | |
<pre id="output"></pre> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.js"></script> | |
<script> | |
var out = $('#output'); | |
$.ajax({ | |
type: "GET", | |
url: 'response.html', | |
success: function () { | |
console.log('success ', arguments); | |
}, | |
error: function () { | |
console.log('error ', arguments); | |
}, | |
complete: function (xhr, status) { | |
if (status === 'error' || !xhr.responseText) { | |
} | |
else { | |
out.append(xhr.responseText); | |
} | |
console.log('complete ', arguments); | |
} | |
}); | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>Success</p> |
Confirmed fixed in JQuery 1.5.1
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When loaded from the filesystem (file: protocol) the error event is fired despite the correct response being received. The complete handler's status is an empty string. This behaviour differs from JQuery1.4.x