Opened 13 years ago
Closed 13 years ago
#5872 closed bug (duplicate)
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.
Change History (9)
comment:1 Changed 13 years ago by
comment:2 Changed 13 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
Sorry but I cannot understand the description here. Can you post a complete test case with code?
comment:3 Changed 13 years ago by
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.
comment:4 Changed 13 years ago by
I can reproduce this error in 1.4.1 by:
- disabling internet connection on client
- initializing the ajax request
- i get success, when I should get error
reverting to 1.3.2 solves the problem.
comment:5 Changed 13 years ago by
The code:
$.ajax({ dataType: 'text', cache: false, timeout: 10000, url: '/', data: {'function': 'sync'}, success: function() { alert('success'); }, error: function() { alert('error'); } });
comment:6 Changed 13 years ago by
Milestone: 1.4.1 needs to be updated and it seems that I don't have the powers to do it.
comment:7 Changed 13 years ago by
Looks like this ticket has been duplicated #5968. The duplicate is filed under the ajax Component.
comment:8 Changed 13 years ago by
The patch in http://dev.jquery.com/ticket/6060 does seem to work.
comment:9 Changed 13 years ago by
Component: | unfiled → ajax |
---|---|
Resolution: | → duplicate |
Status: | reopened → closed |
Merging all to dup #6060.
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.