1

I'm sending a simple Ajax request to Twitter.

$.ajax({
            type: "GET",
            url: "https://api.twitter.com/1/users/show.json?screen_name=twitterAPI&include_entities=true",
            dataType: "jsonp",
            success: function(data, textStatus, jqXHR){
                console.log("success");
            },
            error : function(XMLHttpRequest, textStatus, errorThrown){
                console.log("error");
            }
    });

When I the screen_name exist, the success function is called. But when the screen_name does not exist, I get a Javascript error on my console but the error function is never called.

Where is the mistake?

kschaeffler
  • 4,083
  • 7
  • 33
  • 41
  • What *error message* are you getting? – Lion Jul 23 '12 at 19:29
  • why screen name is empty sometime – zod Jul 23 '12 at 19:34
  • 2
    See [this](http://stackoverflow.com/q/5247295/901048) and [this](http://stackoverflow.com/q/1002367/901048) for tips. Basically, JSONP doesn't ever return an error because it's not like the other AJAX techniques. The most common solution seems to be to use a timeout option in the ajax method. (Also see [this](http://forum.jquery.com/topic/catching-a-jsonp-error)) – Blazemonger Jul 23 '12 at 20:06
  • Yes, it works with the timeout! Thanks! – kschaeffler Jul 23 '12 at 20:18

1 Answers1

0

Looks like you have hit the following bug : http://bugs.jquery.com/ticket/11680

gkns
  • 697
  • 2
  • 12
  • 32