Bug Tracker

Opened 13 years ago

Closed 12 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:


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 arj

One more thing, in firebug on localhost:6666, when I run the .ajax myself, I get:


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.

comment:2 Changed 13 years ago by dmethvin

Resolution: invalid
Status: newclosed

Sorry but I cannot understand the description here. Can you post a complete test case with code?

comment:3 Changed 13 years ago by arj

Resolution: invalid
Status: closedreopened

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 austinjackson

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.

comment:5 Changed 13 years ago by austinjackson

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 arj

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 guy

Looks like this ticket has been duplicated #5968. The duplicate is filed under the ajax Component.

comment:8 Changed 13 years ago by arj

The patch in http://dev.jquery.com/ticket/6060 does seem to work.

comment:9 Changed 12 years ago by dmethvin

Component: unfiledajax
Resolution: duplicate
Status: reopenedclosed

Merging all to dup #6060.

Note: See TracTickets for help on using tickets.