Skip to main content

Bug Tracker

Side navigation

#8173 closed bug (invalid)

Opened February 04, 2011 02:39AM UTC

Closed February 04, 2011 08:23PM UTC

Last modified February 08, 2013 08:31PM UTC

1.5 Ajax not triggering error for bad URL

Reported by: rdibona@yahoo.com Owned by: rdibona@yahoo.com
Priority: low Milestone: 1.next
Component: ajax Version: 1.5
Keywords: Cc:
Blocked by: Blocking:
Description

This simple AJAX call includes a URL that doesn't exist. In 1.5 in Firefox it does not display the alert meaning the error is not being caught (or causes a runtime error in Firebug). In 1.4.4 it properly catches the error in the textStatus.

$('#cmdDetails').bind('click', function()
{
    $.ajax
    ({
        type: "GET",
        dataType: "json",
        url: "server/fakeurl.php",
        complete : function(data, textStatus, jqXHR)
        {
            alert(textStatus);
        }
    })
});
Attachments (0)
Change History (8)

Changed February 04, 2011 10:45AM UTC by jitter comment:1

component: unfiledajax
description: This simple AJAX call includes a URL that doesn't exist. In 1.5 in Firefox it does not display the alert meaning the error is not being caught (or causes a runtime error in Firebug). In 1.4.4 it properly catches the error in the textStatus. \ \ $('#cmdDetails').bind('click', function() \ { \ $.ajax \ ({ \ type: "GET", \ dataType: "json", \ url: "server/fakeurl.php", \ complete : function(data, textStatus, jqXHR) \ { \ alert(textStatus); \ } \ }) \ }); \ This simple AJAX call includes a URL that doesn't exist. In 1.5 in Firefox it does not display the alert meaning the error is not being caught (or causes a runtime error in Firebug). In 1.4.4 it properly catches the error in the textStatus. \ {{{ \ $('#cmdDetails').bind('click', function() \ { \ $.ajax \ ({ \ type: "GET", \ dataType: "json", \ url: "server/fakeurl.php", \ complete : function(data, textStatus, jqXHR) \ { \ alert(textStatus); \ } \ }) \ }); \ }}}
owner: → rdibona@yahoo.com
priority: undecidedlow
status: newpending

Thanks for taking the time to contribute to the jQuery project by writing a bug report!

After checking your report I made this live test case based on your description. I can't seem to reproduce the behavior you described, as I get an alert saying "error" in FF.

So please submit a reduced test case, which reproduces the issue you are experiencing, on http://jsfiddle.net. So that we can investigate this issue further. Also make sure to read the link given below, in order to provide a most useful bug report.


How to report bugs

Changed February 04, 2011 04:45PM UTC by addyosmani comment:2

If you could also include what version of Firefox you're testing with that would be of benefit.

Changed February 04, 2011 07:24PM UTC by rdibona@yahoo.com comment:3

status: pendingnew

It had to do with making the AJAX call from within a form's submit button click event. For some reason, FireFox 3.6.13 did not like this. But it doesn't really have to do with the AJAX call itself, so you can close this ticket.

Thanks very much and I apologize that I did not enter the bug using the proper protocol.

Changed February 04, 2011 08:23PM UTC by jaubourg comment:4

resolution: → invalid
status: newclosed

Changed February 10, 2011 05:45PM UTC by anonymous comment:5

Sorry, I dont like to create jsFiddle acc just to say how to reproduce the bug. Change URL.

url: "http://google.com/fakeurl.php?jsonpCallback=?"

JSONP does not trigger error callbacks, neither local nor global. In 1.5, 1.4.4, 1.4.3, 1.4.2.

Changed February 10, 2011 07:42PM UTC by jitter comment:6

Replying to [comment:5 anonymous]:

Sorry, I dont like to create jsFiddle acc just to say how to reproduce the bug. Change URL. url: "http://google.com/fakeurl.php?jsonpCallback=?" JSONP does not trigger error callbacks, neither local nor global. In 1.5, 1.4.4, 1.4.3, 1.4.2.

Because I can't reliably do so. And the documentation clearly states this behavior.

http://api.jquery.com/jQuery.ajax

error: This handler is not called for cross-domain script and JSONP requests.

Changed February 08, 2013 07:07PM UTC by lokitek@gmail.com comment:7

Just wanted to bring this bug back up to life, as it seems that using HTTPS in the connection prevents the error from showing up.

See Live Example

Changed February 08, 2013 08:31PM UTC by dmethvin comment:8

Please *don't* jump on two-year-old closed bug threads, instead ask for help on the forum.