Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Test case for a possible bug with JQuery 1.5
<!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>
<p>Success</p>
@johnhunter

This comment has been minimized.

Copy link
Owner Author

johnhunter commented Feb 21, 2011

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

@johnhunter

This comment has been minimized.

Copy link
Owner Author

johnhunter commented Feb 25, 2011

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
You can’t perform that action at this time.