Side navigation
#5872 closed bug (duplicate)
Opened January 19, 2010 10:42PM UTC
Closed June 14, 2010 12:19AM UTC
ajax calls succes instead of error on server error
Reported by: | arj | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.4.1 |
Component: | ajax | Version: | 1.4 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Way to reproduce:
request a page, and on load do a local long-polling-request
kill the server
the request callback is success?
I then tried on the same page to run:
$.ajax({type: "GET", url:"http://localhost:6666/", success: function(a, b) { console.log("got success"); }, error: function() { console.log("error"); }});
Gives: "got success"
http://localhost:6666/ is the url that the page is served from.
But loading up a different site that also has jquery loaded and running the same code in firebug results in a "error" in console.
Attachments (0)
Change History (9)
Changed January 19, 2010 10:45PM UTC by comment:1
Changed January 20, 2010 02:06AM UTC by comment:2
resolution: | → invalid |
---|---|
status: | new → closed |
Sorry but I cannot understand the description here. Can you post a complete test case with code?
Changed January 22, 2010 05:16PM UTC by comment:3
resolution: | invalid |
---|---|
status: | closed → reopened |
I can confirm that it is a bug in jquery 1.4. Going back to jquery 1.3.2 fixes.
To reproduce do the following:
Have a server end where you take a long time to respond to a request. Sleeping will work.
Request the url using:
$.ajax({type: "GET", url:"http://localhost:6666/takesVeryLong", success: function(a, b) { console.log("got success"); }, error: function() { console.log("error"); }});
in something like firebug. Then click somewhere else and then escape, this will cancel the request. Firebug now says success even though it's clearly a failure. Please note that the url (http://localhost:6666/) needs to be the same as the page was served from.
Changed January 28, 2010 02:36AM UTC by comment:4
I can reproduce this error in 1.4.1 by:
1. disabling internet connection on client
2. initializing the ajax request
3. i get success, when I should get error
reverting to 1.3.2 solves the problem.
Changed January 28, 2010 02:44AM UTC by comment:5
The code:
$.ajax({
dataType: 'text',
cache: false,
timeout: 10000,
url: '/',
data: {'function': 'sync'},
success: function() {
alert('success');
},
error: function() {
alert('error');
}
});
Changed February 18, 2010 09:56AM UTC by comment:6
Milestone: 1.4.1 needs to be updated and it seems that I don't have the powers to do it.
Changed February 26, 2010 03:49PM UTC by comment:7
Looks like this ticket has been duplicated #5968. The duplicate is filed under the ''ajax'' Component.
Changed March 09, 2010 12:46PM UTC by comment:8
The patch in http://dev.jquery.com/ticket/6060 does seem to work.
One more thing, in firebug on localhost:6666, when I run the .ajax myself, I get:
XMLHttpRequest
while running it on another site gives:
XMLHttpRequest readyState=1 multipart=false
The other site is running jQuery 1.3.2, so not sure if that's is the difference I'm seeing.