Bug Tracker

Modify

Ticket #4847 (closed bug: invalid)

Opened 4 years ago

Last modified 4 years ago

$.ajax error event fail

Reported by: _Thor_ Owned by:
Priority: critical Milestone: 1.4
Component: ajax Version: 1.3.2
Keywords: ajax, local, error Cc:
Blocking: Blocked by:

Description

First, about your Bug Tracker: OperationalError: (2006, 'MySQL server has gone away')

[ 03-07-2009 12:10 CET ]

My problem: When Ajax request is complete (but it's an error - in my case: wrong filename), the "success" function starts working, ignoring the error event.

  • Function:

var url = "somethingwrong.html";

$.ajax({

beforeSend: function(){

alert('beforesend event');

}, error: function(){

alert('error event');

}, success: function(){

alert('success event');

}

});

$("#divname").load(url);

Attachments

bug_4847.html.zip Download (916 bytes) - added by gregory80 4 years ago.
Sample using ajaxSetup();

Change History

comment:1 Changed 4 years ago by _Thor_

Bug Tracker is working again.

Changed 4 years ago by gregory80

Sample using ajaxSetup();

comment:2 Changed 4 years ago by gregory80

Hello, I believe this bug may have been called by confusion between $.ajax() and $.ajaxSetup().

In the above example, you are making two requests. One with $.ajax() and another one with $.load().

The first request, calls the page you are on, which will return a 200. The second request, using $.load(), calls the 404, but no events have been attached.

Instead, if you use $.ajaxSetup() [see attached sample], it will always fire the error event.

comment:3 Changed 4 years ago by dmethvin

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

Closed, see gregory80's explanation.

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.