Bug Tracker

Modify

Ticket #5872 (closed bug: duplicate)

Opened 3 years ago

Last modified 3 years ago

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:
Blocking: Blocked by:

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

comment:1 Changed 3 years ago by arj

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.

comment:2 Changed 3 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid

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

comment:3 Changed 3 years ago by arj

  • Status changed from closed to reopened
  • Resolution invalid deleted

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 3 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 3 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 3 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 3 years ago by guy

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

comment:8 Changed 3 years ago by arj

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

comment:9 Changed 3 years ago by dmethvin

  • Status changed from reopened to closed
  • Resolution set to duplicate
  • Component changed from unfiled to ajax

Merging all to dup #6060.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.